]>
git.saurik.com Git - apple/javascriptcore.git/blob - parser/NodeConstructors.h
2 * Copyright (C) 2009 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
, JSGlobalData
* globalData
)
32 return globalData
->parserArena
->allocateFreeable(size
);
35 inline void* ParserArenaDeletable::operator new(size_t size
, JSGlobalData
* globalData
)
37 return globalData
->parserArena
->allocateDeletable(size
);
40 inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData
* globalData
)
42 globalData
->parserArena
->derefWithArena(adoptRef(this));
45 inline Node::Node(int lineNumber
)
46 : m_lineNumber(lineNumber
)
50 inline ExpressionNode::ExpressionNode(int lineNumber
, ResultType resultType
)
52 , m_resultType(resultType
)
56 inline StatementNode::StatementNode(int lineNumber
)
62 inline NullNode::NullNode(int lineNumber
)
63 : ExpressionNode(lineNumber
, ResultType::nullType())
67 inline BooleanNode::BooleanNode(int lineNumber
, bool value
)
68 : ExpressionNode(lineNumber
, ResultType::booleanType())
73 inline NumberNode::NumberNode(int lineNumber
, double value
)
74 : ExpressionNode(lineNumber
, ResultType::numberType())
79 inline StringNode::StringNode(int lineNumber
, const Identifier
& value
)
80 : ExpressionNode(lineNumber
, ResultType::stringType())
85 inline RegExpNode::RegExpNode(int lineNumber
, const Identifier
& pattern
, const Identifier
& flags
)
86 : ExpressionNode(lineNumber
)
92 inline ThisNode::ThisNode(int lineNumber
)
93 : ExpressionNode(lineNumber
)
97 inline ResolveNode::ResolveNode(int lineNumber
, const Identifier
& ident
, int startOffset
)
98 : ExpressionNode(lineNumber
)
100 , m_startOffset(startOffset
)
104 inline ElementNode::ElementNode(int elision
, ExpressionNode
* node
)
111 inline ElementNode::ElementNode(ElementNode
* l
, int elision
, ExpressionNode
* node
)
119 inline ArrayNode::ArrayNode(int lineNumber
, int elision
)
120 : ExpressionNode(lineNumber
)
127 inline ArrayNode::ArrayNode(int lineNumber
, ElementNode
* element
)
128 : ExpressionNode(lineNumber
)
135 inline ArrayNode::ArrayNode(int lineNumber
, int elision
, ElementNode
* element
)
136 : ExpressionNode(lineNumber
)
143 inline PropertyNode::PropertyNode(JSGlobalData
*, const Identifier
& name
, ExpressionNode
* assign
, Type type
)
150 inline PropertyNode::PropertyNode(JSGlobalData
* globalData
, double name
, ExpressionNode
* assign
, Type type
)
151 : m_name(globalData
->parserArena
->identifierArena().makeNumericIdentifier(globalData
, name
))
157 inline PropertyListNode::PropertyListNode(int lineNumber
, PropertyNode
* node
)
164 inline PropertyListNode::PropertyListNode(int lineNumber
, PropertyNode
* node
, PropertyListNode
* list
)
172 inline ObjectLiteralNode::ObjectLiteralNode(int lineNumber
)
173 : ExpressionNode(lineNumber
)
178 inline ObjectLiteralNode::ObjectLiteralNode(int lineNumber
, PropertyListNode
* list
)
179 : ExpressionNode(lineNumber
)
184 inline BracketAccessorNode::BracketAccessorNode(int lineNumber
, ExpressionNode
* base
, ExpressionNode
* subscript
, bool subscriptHasAssignments
)
185 : ExpressionNode(lineNumber
)
187 , m_subscript(subscript
)
188 , m_subscriptHasAssignments(subscriptHasAssignments
)
192 inline DotAccessorNode::DotAccessorNode(int lineNumber
, ExpressionNode
* base
, const Identifier
& ident
)
193 : ExpressionNode(lineNumber
)
199 inline ArgumentListNode::ArgumentListNode(int lineNumber
, ExpressionNode
* expr
)
206 inline ArgumentListNode::ArgumentListNode(int lineNumber
, ArgumentListNode
* listNode
, ExpressionNode
* expr
)
211 listNode
->m_next
= this;
214 inline ArgumentsNode::ArgumentsNode()
219 inline ArgumentsNode::ArgumentsNode(ArgumentListNode
* listNode
)
220 : m_listNode(listNode
)
224 inline NewExprNode::NewExprNode(int lineNumber
, ExpressionNode
* expr
)
225 : ExpressionNode(lineNumber
)
231 inline NewExprNode::NewExprNode(int lineNumber
, ExpressionNode
* expr
, ArgumentsNode
* args
)
232 : ExpressionNode(lineNumber
)
238 inline EvalFunctionCallNode::EvalFunctionCallNode(int lineNumber
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
239 : ExpressionNode(lineNumber
)
240 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
245 inline FunctionCallValueNode::FunctionCallValueNode(int lineNumber
, ExpressionNode
* expr
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
246 : ExpressionNode(lineNumber
)
247 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
253 inline FunctionCallResolveNode::FunctionCallResolveNode(int lineNumber
, const Identifier
& ident
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
254 : ExpressionNode(lineNumber
)
255 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
261 inline FunctionCallBracketNode::FunctionCallBracketNode(int lineNumber
, ExpressionNode
* base
, ExpressionNode
* subscript
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
262 : ExpressionNode(lineNumber
)
263 , ThrowableSubExpressionData(divot
, startOffset
, endOffset
)
265 , m_subscript(subscript
)
270 inline FunctionCallDotNode::FunctionCallDotNode(int lineNumber
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
271 : ExpressionNode(lineNumber
)
272 , ThrowableSubExpressionData(divot
, startOffset
, endOffset
)
279 inline CallFunctionCallDotNode::CallFunctionCallDotNode(int lineNumber
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
280 : FunctionCallDotNode(lineNumber
, base
, ident
, args
, divot
, startOffset
, endOffset
)
284 inline ApplyFunctionCallDotNode::ApplyFunctionCallDotNode(int lineNumber
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
285 : FunctionCallDotNode(lineNumber
, base
, ident
, args
, divot
, startOffset
, endOffset
)
289 inline PrePostResolveNode::PrePostResolveNode(int lineNumber
, const Identifier
& ident
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
290 : ExpressionNode(lineNumber
, ResultType::numberType()) // could be reusable for pre?
291 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
296 inline PostfixResolveNode::PostfixResolveNode(int lineNumber
, const Identifier
& ident
, Operator oper
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
297 : PrePostResolveNode(lineNumber
, ident
, divot
, startOffset
, endOffset
)
302 inline PostfixBracketNode::PostfixBracketNode(int lineNumber
, ExpressionNode
* base
, ExpressionNode
* subscript
, Operator oper
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
303 : ExpressionNode(lineNumber
)
304 , ThrowableSubExpressionData(divot
, startOffset
, endOffset
)
306 , m_subscript(subscript
)
311 inline PostfixDotNode::PostfixDotNode(int lineNumber
, ExpressionNode
* base
, const Identifier
& ident
, Operator oper
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
312 : ExpressionNode(lineNumber
)
313 , ThrowableSubExpressionData(divot
, startOffset
, endOffset
)
320 inline PostfixErrorNode::PostfixErrorNode(int lineNumber
, ExpressionNode
* expr
, Operator oper
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
321 : ExpressionNode(lineNumber
)
322 , ThrowableSubExpressionData(divot
, startOffset
, endOffset
)
328 inline DeleteResolveNode::DeleteResolveNode(int lineNumber
, const Identifier
& ident
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
329 : ExpressionNode(lineNumber
)
330 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
335 inline DeleteBracketNode::DeleteBracketNode(int lineNumber
, ExpressionNode
* base
, ExpressionNode
* subscript
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
336 : ExpressionNode(lineNumber
)
337 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
339 , m_subscript(subscript
)
343 inline DeleteDotNode::DeleteDotNode(int lineNumber
, ExpressionNode
* base
, const Identifier
& ident
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
344 : ExpressionNode(lineNumber
)
345 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
351 inline DeleteValueNode::DeleteValueNode(int lineNumber
, ExpressionNode
* expr
)
352 : ExpressionNode(lineNumber
)
357 inline VoidNode::VoidNode(int lineNumber
, ExpressionNode
* expr
)
358 : ExpressionNode(lineNumber
)
363 inline TypeOfResolveNode::TypeOfResolveNode(int lineNumber
, const Identifier
& ident
)
364 : ExpressionNode(lineNumber
, ResultType::stringType())
369 inline TypeOfValueNode::TypeOfValueNode(int lineNumber
, ExpressionNode
* expr
)
370 : ExpressionNode(lineNumber
, ResultType::stringType())
375 inline PrefixResolveNode::PrefixResolveNode(int lineNumber
, const Identifier
& ident
, Operator oper
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
376 : PrePostResolveNode(lineNumber
, ident
, divot
, startOffset
, endOffset
)
381 inline PrefixBracketNode::PrefixBracketNode(int lineNumber
, ExpressionNode
* base
, ExpressionNode
* subscript
, Operator oper
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
382 : ExpressionNode(lineNumber
)
383 , ThrowablePrefixedSubExpressionData(divot
, startOffset
, endOffset
)
385 , m_subscript(subscript
)
390 inline PrefixDotNode::PrefixDotNode(int lineNumber
, ExpressionNode
* base
, const Identifier
& ident
, Operator oper
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
391 : ExpressionNode(lineNumber
)
392 , ThrowablePrefixedSubExpressionData(divot
, startOffset
, endOffset
)
399 inline PrefixErrorNode::PrefixErrorNode(int lineNumber
, ExpressionNode
* expr
, Operator oper
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
400 : ExpressionNode(lineNumber
)
401 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
407 inline UnaryOpNode::UnaryOpNode(int lineNumber
, ResultType type
, ExpressionNode
* expr
, OpcodeID opcodeID
)
408 : ExpressionNode(lineNumber
, type
)
410 , m_opcodeID(opcodeID
)
414 inline UnaryPlusNode::UnaryPlusNode(int lineNumber
, ExpressionNode
* expr
)
415 : UnaryOpNode(lineNumber
, ResultType::numberType(), expr
, op_to_jsnumber
)
419 inline NegateNode::NegateNode(int lineNumber
, ExpressionNode
* expr
)
420 : UnaryOpNode(lineNumber
, ResultType::numberType(), expr
, op_negate
)
424 inline BitwiseNotNode::BitwiseNotNode(int lineNumber
, ExpressionNode
* expr
)
425 : ExpressionNode(lineNumber
, ResultType::forBitOp())
430 inline LogicalNotNode::LogicalNotNode(int lineNumber
, ExpressionNode
* expr
)
431 : UnaryOpNode(lineNumber
, ResultType::booleanType(), expr
, op_not
)
435 inline BinaryOpNode::BinaryOpNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
436 : ExpressionNode(lineNumber
)
439 , m_opcodeID(opcodeID
)
440 , m_rightHasAssignments(rightHasAssignments
)
444 inline BinaryOpNode::BinaryOpNode(int lineNumber
, ResultType type
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
445 : ExpressionNode(lineNumber
, type
)
448 , m_opcodeID(opcodeID
)
449 , m_rightHasAssignments(rightHasAssignments
)
453 inline MultNode::MultNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
454 : BinaryOpNode(lineNumber
, ResultType::numberType(), expr1
, expr2
, op_mul
, rightHasAssignments
)
458 inline DivNode::DivNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
459 : BinaryOpNode(lineNumber
, ResultType::numberType(), expr1
, expr2
, op_div
, rightHasAssignments
)
464 inline ModNode::ModNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
465 : BinaryOpNode(lineNumber
, ResultType::numberType(), expr1
, expr2
, op_mod
, rightHasAssignments
)
469 inline AddNode::AddNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
470 : BinaryOpNode(lineNumber
, ResultType::forAdd(expr1
->resultDescriptor(), expr2
->resultDescriptor()), expr1
, expr2
, op_add
, rightHasAssignments
)
474 inline SubNode::SubNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
475 : BinaryOpNode(lineNumber
, ResultType::numberType(), expr1
, expr2
, op_sub
, rightHasAssignments
)
479 inline LeftShiftNode::LeftShiftNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
480 : BinaryOpNode(lineNumber
, ResultType::forBitOp(), expr1
, expr2
, op_lshift
, rightHasAssignments
)
484 inline RightShiftNode::RightShiftNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
485 : BinaryOpNode(lineNumber
, ResultType::forBitOp(), expr1
, expr2
, op_rshift
, rightHasAssignments
)
489 inline UnsignedRightShiftNode::UnsignedRightShiftNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
490 : BinaryOpNode(lineNumber
, ResultType::numberType(), expr1
, expr2
, op_urshift
, rightHasAssignments
)
494 inline LessNode::LessNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
495 : BinaryOpNode(lineNumber
, ResultType::booleanType(), expr1
, expr2
, op_less
, rightHasAssignments
)
499 inline GreaterNode::GreaterNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
500 : BinaryOpNode(lineNumber
, ResultType::booleanType(), expr1
, expr2
, op_greater
, rightHasAssignments
)
504 inline LessEqNode::LessEqNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
505 : BinaryOpNode(lineNumber
, ResultType::booleanType(), expr1
, expr2
, op_lesseq
, rightHasAssignments
)
509 inline GreaterEqNode::GreaterEqNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
510 : BinaryOpNode(lineNumber
, ResultType::booleanType(), expr1
, expr2
, op_greatereq
, rightHasAssignments
)
514 inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(int lineNumber
, ResultType type
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
515 : BinaryOpNode(lineNumber
, type
, expr1
, expr2
, opcodeID
, rightHasAssignments
)
519 inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
520 : BinaryOpNode(lineNumber
, expr1
, expr2
, opcodeID
, rightHasAssignments
)
524 inline InstanceOfNode::InstanceOfNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
525 : ThrowableBinaryOpNode(lineNumber
, ResultType::booleanType(), expr1
, expr2
, op_instanceof
, rightHasAssignments
)
529 inline InNode::InNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
530 : ThrowableBinaryOpNode(lineNumber
, expr1
, expr2
, op_in
, rightHasAssignments
)
534 inline EqualNode::EqualNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
535 : BinaryOpNode(lineNumber
, ResultType::booleanType(), expr1
, expr2
, op_eq
, rightHasAssignments
)
539 inline NotEqualNode::NotEqualNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
540 : BinaryOpNode(lineNumber
, ResultType::booleanType(), expr1
, expr2
, op_neq
, rightHasAssignments
)
544 inline StrictEqualNode::StrictEqualNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
545 : BinaryOpNode(lineNumber
, ResultType::booleanType(), expr1
, expr2
, op_stricteq
, rightHasAssignments
)
549 inline NotStrictEqualNode::NotStrictEqualNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
550 : BinaryOpNode(lineNumber
, ResultType::booleanType(), expr1
, expr2
, op_nstricteq
, rightHasAssignments
)
554 inline BitAndNode::BitAndNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
555 : BinaryOpNode(lineNumber
, ResultType::forBitOp(), expr1
, expr2
, op_bitand
, rightHasAssignments
)
559 inline BitOrNode::BitOrNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
560 : BinaryOpNode(lineNumber
, ResultType::forBitOp(), expr1
, expr2
, op_bitor
, rightHasAssignments
)
564 inline BitXOrNode::BitXOrNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
565 : BinaryOpNode(lineNumber
, ResultType::forBitOp(), expr1
, expr2
, op_bitxor
, rightHasAssignments
)
569 inline LogicalOpNode::LogicalOpNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, LogicalOperator oper
)
570 : ExpressionNode(lineNumber
, ResultType::booleanType())
577 inline ConditionalNode::ConditionalNode(int lineNumber
, ExpressionNode
* logical
, ExpressionNode
* expr1
, ExpressionNode
* expr2
)
578 : ExpressionNode(lineNumber
)
585 inline ReadModifyResolveNode::ReadModifyResolveNode(int lineNumber
, const Identifier
& ident
, Operator oper
, ExpressionNode
* right
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
586 : ExpressionNode(lineNumber
)
587 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
591 , m_rightHasAssignments(rightHasAssignments
)
595 inline AssignResolveNode::AssignResolveNode(int lineNumber
, const Identifier
& ident
, ExpressionNode
* right
, bool rightHasAssignments
)
596 : ExpressionNode(lineNumber
)
599 , m_rightHasAssignments(rightHasAssignments
)
603 inline ReadModifyBracketNode::ReadModifyBracketNode(int lineNumber
, ExpressionNode
* base
, ExpressionNode
* subscript
, Operator oper
, ExpressionNode
* right
, bool subscriptHasAssignments
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
604 : ExpressionNode(lineNumber
)
605 , ThrowableSubExpressionData(divot
, startOffset
, endOffset
)
607 , m_subscript(subscript
)
610 , m_subscriptHasAssignments(subscriptHasAssignments
)
611 , m_rightHasAssignments(rightHasAssignments
)
615 inline AssignBracketNode::AssignBracketNode(int lineNumber
, ExpressionNode
* base
, ExpressionNode
* subscript
, ExpressionNode
* right
, bool subscriptHasAssignments
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
616 : ExpressionNode(lineNumber
)
617 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
619 , m_subscript(subscript
)
621 , m_subscriptHasAssignments(subscriptHasAssignments
)
622 , m_rightHasAssignments(rightHasAssignments
)
626 inline AssignDotNode::AssignDotNode(int lineNumber
, ExpressionNode
* base
, const Identifier
& ident
, ExpressionNode
* right
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
627 : ExpressionNode(lineNumber
)
628 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
632 , m_rightHasAssignments(rightHasAssignments
)
636 inline ReadModifyDotNode::ReadModifyDotNode(int lineNumber
, ExpressionNode
* base
, const Identifier
& ident
, Operator oper
, ExpressionNode
* right
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
637 : ExpressionNode(lineNumber
)
638 , ThrowableSubExpressionData(divot
, startOffset
, endOffset
)
643 , m_rightHasAssignments(rightHasAssignments
)
647 inline AssignErrorNode::AssignErrorNode(int lineNumber
, ExpressionNode
* left
, Operator oper
, ExpressionNode
* right
, unsigned divot
, unsigned startOffset
, unsigned endOffset
)
648 : ExpressionNode(lineNumber
)
649 , ThrowableExpressionData(divot
, startOffset
, endOffset
)
656 inline CommaNode::CommaNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
)
657 : ExpressionNode(lineNumber
)
659 m_expressions
.append(expr1
);
660 m_expressions
.append(expr2
);
663 inline ConstStatementNode::ConstStatementNode(int lineNumber
, ConstDeclNode
* next
)
664 : StatementNode(lineNumber
)
669 inline SourceElements::SourceElements()
673 inline EmptyStatementNode::EmptyStatementNode(int lineNumber
)
674 : StatementNode(lineNumber
)
678 inline DebuggerStatementNode::DebuggerStatementNode(int lineNumber
)
679 : StatementNode(lineNumber
)
683 inline ExprStatementNode::ExprStatementNode(int lineNumber
, ExpressionNode
* expr
)
684 : StatementNode(lineNumber
)
689 inline VarStatementNode::VarStatementNode(int lineNumber
, ExpressionNode
* expr
)
690 : StatementNode(lineNumber
)
695 inline IfNode::IfNode(int lineNumber
, ExpressionNode
* condition
, StatementNode
* ifBlock
)
696 : StatementNode(lineNumber
)
697 , m_condition(condition
)
702 inline IfElseNode::IfElseNode(int lineNumber
, ExpressionNode
* condition
, StatementNode
* ifBlock
, StatementNode
* elseBlock
)
703 : IfNode(lineNumber
, condition
, ifBlock
)
704 , m_elseBlock(elseBlock
)
708 inline DoWhileNode::DoWhileNode(int lineNumber
, StatementNode
* statement
, ExpressionNode
* expr
)
709 : StatementNode(lineNumber
)
710 , m_statement(statement
)
715 inline WhileNode::WhileNode(int lineNumber
, ExpressionNode
* expr
, StatementNode
* statement
)
716 : StatementNode(lineNumber
)
718 , m_statement(statement
)
722 inline ForNode::ForNode(int lineNumber
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, ExpressionNode
* expr3
, StatementNode
* statement
, bool expr1WasVarDecl
)
723 : StatementNode(lineNumber
)
727 , m_statement(statement
)
728 , m_expr1WasVarDecl(expr1
&& expr1WasVarDecl
)
733 inline ContinueNode::ContinueNode(JSGlobalData
* globalData
, int lineNumber
)
734 : StatementNode(lineNumber
)
735 , m_ident(globalData
->propertyNames
->nullIdentifier
)
739 inline ContinueNode::ContinueNode(int lineNumber
, const Identifier
& ident
)
740 : StatementNode(lineNumber
)
745 inline BreakNode::BreakNode(JSGlobalData
* globalData
, int lineNumber
)
746 : StatementNode(lineNumber
)
747 , m_ident(globalData
->propertyNames
->nullIdentifier
)
751 inline BreakNode::BreakNode(int lineNumber
, const Identifier
& ident
)
752 : StatementNode(lineNumber
)
757 inline ReturnNode::ReturnNode(int lineNumber
, ExpressionNode
* value
)
758 : StatementNode(lineNumber
)
763 inline WithNode::WithNode(int lineNumber
, ExpressionNode
* expr
, StatementNode
* statement
, uint32_t divot
, uint32_t expressionLength
)
764 : StatementNode(lineNumber
)
766 , m_statement(statement
)
768 , m_expressionLength(expressionLength
)
772 inline LabelNode::LabelNode(int lineNumber
, const Identifier
& name
, StatementNode
* statement
)
773 : StatementNode(lineNumber
)
775 , m_statement(statement
)
779 inline ThrowNode::ThrowNode(int lineNumber
, ExpressionNode
* expr
)
780 : StatementNode(lineNumber
)
785 inline TryNode::TryNode(int lineNumber
, StatementNode
* tryBlock
, const Identifier
& exceptionIdent
, StatementNode
* catchBlock
, StatementNode
* finallyBlock
)
786 : StatementNode(lineNumber
)
787 , m_tryBlock(tryBlock
)
788 , m_exceptionIdent(exceptionIdent
)
789 , m_catchBlock(catchBlock
)
790 , m_finallyBlock(finallyBlock
)
794 inline ParameterNode::ParameterNode(const Identifier
& ident
)
800 inline ParameterNode::ParameterNode(ParameterNode
* l
, const Identifier
& ident
)
807 inline FuncExprNode::FuncExprNode(int lineNumber
, const Identifier
& ident
, FunctionBodyNode
* body
, const SourceCode
& source
, ParameterNode
* parameter
)
808 : ExpressionNode(lineNumber
)
811 m_body
->finishParsing(source
, parameter
, ident
);
814 inline FuncDeclNode::FuncDeclNode(int lineNumber
, const Identifier
& ident
, FunctionBodyNode
* body
, const SourceCode
& source
, ParameterNode
* parameter
)
815 : StatementNode(lineNumber
)
818 m_body
->finishParsing(source
, parameter
, ident
);
821 inline CaseClauseNode::CaseClauseNode(ExpressionNode
* expr
, SourceElements
* statements
)
823 , m_statements(statements
)
827 inline ClauseListNode::ClauseListNode(CaseClauseNode
* clause
)
833 inline ClauseListNode::ClauseListNode(ClauseListNode
* clauseList
, CaseClauseNode
* clause
)
837 clauseList
->m_next
= this;
840 inline CaseBlockNode::CaseBlockNode(ClauseListNode
* list1
, CaseClauseNode
* defaultClause
, ClauseListNode
* list2
)
842 , m_defaultClause(defaultClause
)
847 inline SwitchNode::SwitchNode(int lineNumber
, ExpressionNode
* expr
, CaseBlockNode
* block
)
848 : StatementNode(lineNumber
)
854 inline ConstDeclNode::ConstDeclNode(int lineNumber
, const Identifier
& ident
, ExpressionNode
* init
)
855 : ExpressionNode(lineNumber
)
862 inline BlockNode::BlockNode(int lineNumber
, SourceElements
* statements
)
863 : StatementNode(lineNumber
)
864 , m_statements(statements
)
868 inline ForInNode::ForInNode(JSGlobalData
* globalData
, int lineNumber
, ExpressionNode
* l
, ExpressionNode
* expr
, StatementNode
* statement
)
869 : StatementNode(lineNumber
)
870 , m_ident(globalData
->propertyNames
->nullIdentifier
)
874 , m_statement(statement
)
875 , m_identIsVarDecl(false)
879 inline ForInNode::ForInNode(JSGlobalData
* globalData
, int lineNumber
, const Identifier
& ident
, ExpressionNode
* in
, ExpressionNode
* expr
, StatementNode
* statement
, int divot
, int startOffset
, int endOffset
)
880 : StatementNode(lineNumber
)
883 , m_lexpr(new (globalData
) ResolveNode(lineNumber
, ident
, divot
- startOffset
))
885 , m_statement(statement
)
886 , m_identIsVarDecl(true)
889 AssignResolveNode
* node
= new (globalData
) AssignResolveNode(lineNumber
, ident
, in
, true);
890 node
->setExceptionSourceCode(divot
, divot
- startOffset
, endOffset
- divot
);
893 // for( var foo = bar in baz )
898 #endif // NodeConstructors_h