]>
git.saurik.com Git - apple/javascriptcore.git/blob - parser/NodeConstructors.h
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_lineNumber(location
.line
)
47 , m_startOffset(location
.startOffset
)
48 , m_lineStartOffset(location
.lineStartOffset
)
50 ASSERT(location
.startOffset
>= location
.lineStartOffset
);
53 inline ExpressionNode::ExpressionNode(const JSTokenLocation
& location
, ResultType resultType
)
55 , m_resultType(resultType
)
59 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 StringNode::StringNode(const JSTokenLocation
& location
, const Identifier
& value
)
88 : ConstantNode(location
, ResultType::stringType())
93 inline RegExpNode::RegExpNode(const JSTokenLocation
& location
, const Identifier
& pattern
, const Identifier
& flags
)
94 : ExpressionNode(location
)
100 inline ThisNode::ThisNode(const JSTokenLocation
& location
)
101 : ExpressionNode(location
)
105 inline ResolveNode::ResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, unsigned startOffset
, unsigned divotLine
, unsigned divotLineStart
)
106 : ExpressionNode(location
)
108 , m_startOffset(startOffset
)
109 , m_divotLine(divotLine
)
110 , m_divotLineStart(divotLineStart
)
112 ASSERT(m_startOffset
>= m_divotLineStart
);
115 inline ElementNode::ElementNode(int elision
, ExpressionNode
* node
)
122 inline ElementNode::ElementNode(ElementNode
* l
, int elision
, ExpressionNode
* node
)
130 inline ArrayNode::ArrayNode(const JSTokenLocation
& location
, int elision
)
131 : ExpressionNode(location
)
138 inline ArrayNode::ArrayNode(const JSTokenLocation
& location
, ElementNode
* element
)
139 : ExpressionNode(location
)
146 inline ArrayNode::ArrayNode(const JSTokenLocation
& location
, int elision
, ElementNode
* element
)
147 : ExpressionNode(location
)
154 inline PropertyNode::PropertyNode(VM
*, const Identifier
& name
, ExpressionNode
* assign
, Type type
)
161 inline PropertyNode::PropertyNode(VM
* vm
, double name
, ExpressionNode
* assign
, Type type
)
162 : m_name(vm
->parserArena
->identifierArena().makeNumericIdentifier(vm
, name
))
168 inline PropertyListNode::PropertyListNode(const JSTokenLocation
& location
, PropertyNode
* node
)
169 : ExpressionNode(location
)
175 inline PropertyListNode::PropertyListNode(const JSTokenLocation
& location
, PropertyNode
* node
, PropertyListNode
* list
)
176 : ExpressionNode(location
)
183 inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation
& location
)
184 : ExpressionNode(location
)
189 inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation
& location
, PropertyListNode
* list
)
190 : ExpressionNode(location
)
195 inline BracketAccessorNode::BracketAccessorNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, bool subscriptHasAssignments
)
196 : ExpressionNode(location
)
198 , m_subscript(subscript
)
199 , m_subscriptHasAssignments(subscriptHasAssignments
)
203 inline DotAccessorNode::DotAccessorNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
)
204 : ExpressionNode(location
)
210 inline ArgumentListNode::ArgumentListNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
211 : ExpressionNode(location
)
217 inline ArgumentListNode::ArgumentListNode(const JSTokenLocation
& location
, ArgumentListNode
* listNode
, ExpressionNode
* expr
)
218 : ExpressionNode(location
)
222 listNode
->m_next
= this;
225 inline ArgumentsNode::ArgumentsNode()
230 inline ArgumentsNode::ArgumentsNode(ArgumentListNode
* listNode
)
231 : m_listNode(listNode
)
235 inline NewExprNode::NewExprNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
236 : ExpressionNode(location
)
242 inline NewExprNode::NewExprNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, ArgumentsNode
* args
)
243 : ExpressionNode(location
)
249 inline EvalFunctionCallNode::EvalFunctionCallNode(const JSTokenLocation
& location
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
250 : ExpressionNode(location
)
251 , ThrowableExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
254 ASSERT(divot
>= divotLineStart
);
257 inline FunctionCallValueNode::FunctionCallValueNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
258 : ExpressionNode(location
)
259 , ThrowableExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
265 inline FunctionCallResolveNode::FunctionCallResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
266 : ExpressionNode(location
)
267 , ThrowableExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
273 inline FunctionCallBracketNode::FunctionCallBracketNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
274 : ExpressionNode(location
)
275 , ThrowableSubExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
277 , m_subscript(subscript
)
282 inline FunctionCallDotNode::FunctionCallDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
283 : ExpressionNode(location
)
284 , ThrowableSubExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
291 inline CallFunctionCallDotNode::CallFunctionCallDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
292 : FunctionCallDotNode(location
, base
, ident
, args
, divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
296 inline ApplyFunctionCallDotNode::ApplyFunctionCallDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ArgumentsNode
* args
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
297 : FunctionCallDotNode(location
, base
, ident
, args
, divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
301 inline PostfixNode::PostfixNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, Operator oper
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
302 : PrefixNode(location
, expr
, oper
, divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
306 inline DeleteResolveNode::DeleteResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
307 : ExpressionNode(location
)
308 , ThrowableExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
313 inline DeleteBracketNode::DeleteBracketNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
314 : ExpressionNode(location
)
315 , ThrowableExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
317 , m_subscript(subscript
)
321 inline DeleteDotNode::DeleteDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
322 : ExpressionNode(location
)
323 , ThrowableExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
329 inline DeleteValueNode::DeleteValueNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
330 : ExpressionNode(location
)
335 inline VoidNode::VoidNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
336 : ExpressionNode(location
)
341 inline TypeOfResolveNode::TypeOfResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
)
342 : ExpressionNode(location
, ResultType::stringType())
347 inline TypeOfValueNode::TypeOfValueNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
348 : ExpressionNode(location
, ResultType::stringType())
353 inline PrefixNode::PrefixNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, Operator oper
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
354 : ExpressionNode(location
)
355 , ThrowablePrefixedSubExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
361 inline UnaryOpNode::UnaryOpNode(const JSTokenLocation
& location
, ResultType type
, ExpressionNode
* expr
, OpcodeID opcodeID
)
362 : ExpressionNode(location
, type
)
364 , m_opcodeID(opcodeID
)
368 inline UnaryPlusNode::UnaryPlusNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
369 : UnaryOpNode(location
, ResultType::numberType(), expr
, op_to_number
)
373 inline NegateNode::NegateNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
374 : UnaryOpNode(location
, ResultType::numberType(), expr
, op_negate
)
378 inline BitwiseNotNode::BitwiseNotNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
379 : ExpressionNode(location
, ResultType::forBitOp())
384 inline LogicalNotNode::LogicalNotNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
385 : UnaryOpNode(location
, ResultType::booleanType(), expr
, op_not
)
389 inline BinaryOpNode::BinaryOpNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
390 : ExpressionNode(location
)
393 , m_opcodeID(opcodeID
)
394 , m_rightHasAssignments(rightHasAssignments
)
398 inline BinaryOpNode::BinaryOpNode(const JSTokenLocation
& location
, ResultType type
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
399 : ExpressionNode(location
, type
)
402 , m_opcodeID(opcodeID
)
403 , m_rightHasAssignments(rightHasAssignments
)
407 inline MultNode::MultNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
408 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_mul
, rightHasAssignments
)
412 inline DivNode::DivNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
413 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_div
, rightHasAssignments
)
418 inline ModNode::ModNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
419 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_mod
, rightHasAssignments
)
423 inline AddNode::AddNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
424 : BinaryOpNode(location
, ResultType::forAdd(expr1
->resultDescriptor(), expr2
->resultDescriptor()), expr1
, expr2
, op_add
, rightHasAssignments
)
428 inline SubNode::SubNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
429 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_sub
, rightHasAssignments
)
433 inline LeftShiftNode::LeftShiftNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
434 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_lshift
, rightHasAssignments
)
438 inline RightShiftNode::RightShiftNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
439 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_rshift
, rightHasAssignments
)
443 inline UnsignedRightShiftNode::UnsignedRightShiftNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
444 : BinaryOpNode(location
, ResultType::numberType(), expr1
, expr2
, op_urshift
, rightHasAssignments
)
448 inline LessNode::LessNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
449 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_less
, rightHasAssignments
)
453 inline GreaterNode::GreaterNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
454 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_greater
, rightHasAssignments
)
458 inline LessEqNode::LessEqNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
459 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_lesseq
, rightHasAssignments
)
463 inline GreaterEqNode::GreaterEqNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
464 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_greatereq
, rightHasAssignments
)
468 inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(const JSTokenLocation
& location
, ResultType type
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
469 : BinaryOpNode(location
, type
, expr1
, expr2
, opcodeID
, rightHasAssignments
)
473 inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, OpcodeID opcodeID
, bool rightHasAssignments
)
474 : BinaryOpNode(location
, expr1
, expr2
, opcodeID
, rightHasAssignments
)
478 inline InstanceOfNode::InstanceOfNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
479 : ThrowableBinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_instanceof
, rightHasAssignments
)
483 inline InNode::InNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
484 : ThrowableBinaryOpNode(location
, expr1
, expr2
, op_in
, rightHasAssignments
)
488 inline EqualNode::EqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
489 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_eq
, rightHasAssignments
)
493 inline NotEqualNode::NotEqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
494 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_neq
, rightHasAssignments
)
498 inline StrictEqualNode::StrictEqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
499 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_stricteq
, rightHasAssignments
)
503 inline NotStrictEqualNode::NotStrictEqualNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
504 : BinaryOpNode(location
, ResultType::booleanType(), expr1
, expr2
, op_nstricteq
, rightHasAssignments
)
508 inline BitAndNode::BitAndNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
509 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_bitand
, rightHasAssignments
)
513 inline BitOrNode::BitOrNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
514 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_bitor
, rightHasAssignments
)
518 inline BitXOrNode::BitXOrNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, bool rightHasAssignments
)
519 : BinaryOpNode(location
, ResultType::forBitOp(), expr1
, expr2
, op_bitxor
, rightHasAssignments
)
523 inline LogicalOpNode::LogicalOpNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, LogicalOperator oper
)
524 : ExpressionNode(location
, ResultType::booleanType())
531 inline ConditionalNode::ConditionalNode(const JSTokenLocation
& location
, ExpressionNode
* logical
, ExpressionNode
* expr1
, ExpressionNode
* expr2
)
532 : ExpressionNode(location
)
539 inline ReadModifyResolveNode::ReadModifyResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, Operator oper
, ExpressionNode
* right
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
540 : ExpressionNode(location
)
541 , ThrowableExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
545 , m_rightHasAssignments(rightHasAssignments
)
547 ASSERT(divot
>= divotLineStart
);
548 ASSERT(divot
- startOffset
>= divotLineStart
);
551 inline AssignResolveNode::AssignResolveNode(const JSTokenLocation
& location
, const Identifier
& ident
, ExpressionNode
* right
)
552 : ExpressionNode(location
)
558 inline ReadModifyBracketNode::ReadModifyBracketNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, Operator oper
, ExpressionNode
* right
, bool subscriptHasAssignments
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
559 : ExpressionNode(location
)
560 , ThrowableSubExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
562 , m_subscript(subscript
)
565 , m_subscriptHasAssignments(subscriptHasAssignments
)
566 , m_rightHasAssignments(rightHasAssignments
)
570 inline AssignBracketNode::AssignBracketNode(const JSTokenLocation
& location
, ExpressionNode
* base
, ExpressionNode
* subscript
, ExpressionNode
* right
, bool subscriptHasAssignments
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
571 : ExpressionNode(location
)
572 , ThrowableExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
574 , m_subscript(subscript
)
576 , m_subscriptHasAssignments(subscriptHasAssignments
)
577 , m_rightHasAssignments(rightHasAssignments
)
581 inline AssignDotNode::AssignDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, ExpressionNode
* right
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
582 : ExpressionNode(location
)
583 , ThrowableExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
587 , m_rightHasAssignments(rightHasAssignments
)
591 inline ReadModifyDotNode::ReadModifyDotNode(const JSTokenLocation
& location
, ExpressionNode
* base
, const Identifier
& ident
, Operator oper
, ExpressionNode
* right
, bool rightHasAssignments
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
592 : ExpressionNode(location
)
593 , ThrowableSubExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
598 , m_rightHasAssignments(rightHasAssignments
)
602 inline AssignErrorNode::AssignErrorNode(const JSTokenLocation
& location
, unsigned divot
, unsigned startOffset
, unsigned endOffset
, unsigned divotLine
, unsigned divotLineStart
)
603 : ExpressionNode(location
)
604 , ThrowableExpressionData(divot
, startOffset
, endOffset
, divotLine
, divotLineStart
)
608 inline CommaNode::CommaNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
)
609 : ExpressionNode(location
)
611 m_expressions
.append(expr1
);
612 m_expressions
.append(expr2
);
615 inline ConstStatementNode::ConstStatementNode(const JSTokenLocation
& location
, ConstDeclNode
* next
)
616 : StatementNode(location
)
621 inline SourceElements::SourceElements()
625 inline EmptyStatementNode::EmptyStatementNode(const JSTokenLocation
& location
)
626 : StatementNode(location
)
630 inline DebuggerStatementNode::DebuggerStatementNode(const JSTokenLocation
& location
)
631 : StatementNode(location
)
635 inline ExprStatementNode::ExprStatementNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
636 : StatementNode(location
)
641 inline VarStatementNode::VarStatementNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
642 : StatementNode(location
)
647 inline IfElseNode::IfElseNode(const JSTokenLocation
& location
, ExpressionNode
* condition
, StatementNode
* ifBlock
, StatementNode
* elseBlock
)
648 : StatementNode(location
)
649 , m_condition(condition
)
651 , m_elseBlock(elseBlock
)
655 inline DoWhileNode::DoWhileNode(const JSTokenLocation
& location
, StatementNode
* statement
, ExpressionNode
* expr
)
656 : StatementNode(location
)
657 , m_statement(statement
)
662 inline WhileNode::WhileNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, StatementNode
* statement
)
663 : StatementNode(location
)
665 , m_statement(statement
)
669 inline ForNode::ForNode(const JSTokenLocation
& location
, ExpressionNode
* expr1
, ExpressionNode
* expr2
, ExpressionNode
* expr3
, StatementNode
* statement
)
670 : StatementNode(location
)
674 , m_statement(statement
)
679 inline ContinueNode::ContinueNode(VM
* vm
, const JSTokenLocation
& location
)
680 : StatementNode(location
)
681 , m_ident(vm
->propertyNames
->nullIdentifier
)
685 inline ContinueNode::ContinueNode(const JSTokenLocation
& location
, const Identifier
& ident
)
686 : StatementNode(location
)
691 inline BreakNode::BreakNode(VM
* vm
, const JSTokenLocation
& location
)
692 : StatementNode(location
)
693 , m_ident(vm
->propertyNames
->nullIdentifier
)
697 inline BreakNode::BreakNode(const JSTokenLocation
& location
, const Identifier
& ident
)
698 : StatementNode(location
)
703 inline ReturnNode::ReturnNode(const JSTokenLocation
& location
, ExpressionNode
* value
)
704 : StatementNode(location
)
709 inline WithNode::WithNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, StatementNode
* statement
, uint32_t divot
, unsigned divotLine
, unsigned divotLineStart
, uint32_t expressionLength
)
710 : StatementNode(location
)
712 , m_statement(statement
)
714 , m_divotLine(divotLine
)
715 , m_divotLineStart(divotLineStart
)
716 , m_expressionLength(expressionLength
)
720 inline LabelNode::LabelNode(const JSTokenLocation
& location
, const Identifier
& name
, StatementNode
* statement
)
721 : StatementNode(location
)
723 , m_statement(statement
)
727 inline ThrowNode::ThrowNode(const JSTokenLocation
& location
, ExpressionNode
* expr
)
728 : StatementNode(location
)
733 inline TryNode::TryNode(const JSTokenLocation
& location
, StatementNode
* tryBlock
, const Identifier
& exceptionIdent
, StatementNode
* catchBlock
, StatementNode
* finallyBlock
)
734 : StatementNode(location
)
735 , m_tryBlock(tryBlock
)
736 , m_exceptionIdent(exceptionIdent
)
737 , m_catchBlock(catchBlock
)
738 , m_finallyBlock(finallyBlock
)
742 inline ParameterNode::ParameterNode(const Identifier
& ident
)
748 inline ParameterNode::ParameterNode(ParameterNode
* l
, const Identifier
& ident
)
755 inline FuncExprNode::FuncExprNode(const JSTokenLocation
& location
, const Identifier
& ident
, FunctionBodyNode
* body
, const SourceCode
& source
, ParameterNode
* parameter
)
756 : ExpressionNode(location
)
759 m_body
->finishParsing(source
, parameter
, ident
, FunctionNameIsInScope
);
762 inline FuncDeclNode::FuncDeclNode(const JSTokenLocation
& location
, const Identifier
& ident
, FunctionBodyNode
* body
, const SourceCode
& source
, ParameterNode
* parameter
)
763 : StatementNode(location
)
766 m_body
->finishParsing(source
, parameter
, ident
, FunctionNameIsNotInScope
);
769 inline CaseClauseNode::CaseClauseNode(ExpressionNode
* expr
, SourceElements
* statements
)
771 , m_statements(statements
)
775 inline ClauseListNode::ClauseListNode(CaseClauseNode
* clause
)
781 inline ClauseListNode::ClauseListNode(ClauseListNode
* clauseList
, CaseClauseNode
* clause
)
785 clauseList
->m_next
= this;
788 inline CaseBlockNode::CaseBlockNode(ClauseListNode
* list1
, CaseClauseNode
* defaultClause
, ClauseListNode
* list2
)
790 , m_defaultClause(defaultClause
)
795 inline SwitchNode::SwitchNode(const JSTokenLocation
& location
, ExpressionNode
* expr
, CaseBlockNode
* block
)
796 : StatementNode(location
)
802 inline ConstDeclNode::ConstDeclNode(const JSTokenLocation
& location
, const Identifier
& ident
, ExpressionNode
* init
)
803 : ExpressionNode(location
)
810 inline BlockNode::BlockNode(const JSTokenLocation
& location
, SourceElements
* statements
)
811 : StatementNode(location
)
812 , m_statements(statements
)
816 inline ForInNode::ForInNode(const JSTokenLocation
& location
, ExpressionNode
* l
, ExpressionNode
* expr
, StatementNode
* statement
)
817 : StatementNode(location
)
821 , m_statement(statement
)
825 inline ForInNode::ForInNode(VM
* vm
, const JSTokenLocation
& location
, const Identifier
& ident
, ExpressionNode
* in
, ExpressionNode
* expr
, StatementNode
* statement
, unsigned divot
, int startOffset
, int endOffset
, unsigned divotLine
, unsigned divotLineStart
)
826 : StatementNode(location
)
828 , m_lexpr(new (vm
) ResolveNode(location
, ident
, divot
- startOffset
, divotLine
, divotLineStart
))
830 , m_statement(statement
)
833 AssignResolveNode
* node
= new (vm
) AssignResolveNode(location
, ident
, in
);
834 ASSERT(divot
>= divotLineStart
);
835 node
->setExceptionSourceCode(divot
, divot
- startOffset
, endOffset
- divot
, divotLine
, divotLineStart
);
838 // for( var foo = bar in baz )
843 #endif // NodeConstructors_h