X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/f9bf01c6616d5ddcf65b13b33cedf9e387ff7a63..40a37d088818fc2fbeba2ef850dbcaaf294befbf:/parser/NodeConstructors.h diff --git a/parser/NodeConstructors.h b/parser/NodeConstructors.h index dd3b981..2083aa4 100644 --- a/parser/NodeConstructors.h +++ b/parser/NodeConstructors.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2013 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,88 +27,95 @@ namespace JSC { - inline void* ParserArenaFreeable::operator new(size_t size, JSGlobalData* globalData) + inline void* ParserArenaFreeable::operator new(size_t size, VM* vm) { - return globalData->parser->arena().allocateFreeable(size); + return vm->parserArena->allocateFreeable(size); } - inline void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData) + inline void* ParserArenaDeletable::operator new(size_t size, VM* vm) { - return globalData->parser->arena().allocateDeletable(size); + return vm->parserArena->allocateDeletable(size); } - inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData* globalData) + inline ParserArenaRefCounted::ParserArenaRefCounted(VM* vm) { - globalData->parser->arena().derefWithArena(adoptRef(this)); + vm->parserArena->derefWithArena(adoptRef(this)); } - inline Node::Node(JSGlobalData* globalData) - : m_line(globalData->lexer->lineNumber()) + inline Node::Node(const JSTokenLocation& location) + : m_position(location.line, location.startOffset, location.lineStartOffset) { + ASSERT(location.startOffset >= location.lineStartOffset); } - inline ExpressionNode::ExpressionNode(JSGlobalData* globalData, ResultType resultType) - : Node(globalData) + inline ExpressionNode::ExpressionNode(const JSTokenLocation& location, ResultType resultType) + : Node(location) , m_resultType(resultType) { } - inline StatementNode::StatementNode(JSGlobalData* globalData) - : Node(globalData) + inline StatementNode::StatementNode(const JSTokenLocation& location) + : Node(location) , m_lastLine(-1) { } - inline NullNode::NullNode(JSGlobalData* globalData) - : ExpressionNode(globalData, ResultType::nullType()) + inline ConstantNode::ConstantNode(const JSTokenLocation& location, ResultType resultType) + : ExpressionNode(location, resultType) { } - inline BooleanNode::BooleanNode(JSGlobalData* globalData, bool value) - : ExpressionNode(globalData, ResultType::booleanType()) + inline NullNode::NullNode(const JSTokenLocation& location) + : ConstantNode(location, ResultType::nullType()) + { + } + + inline BooleanNode::BooleanNode(const JSTokenLocation& location, bool value) + : ConstantNode(location, ResultType::booleanType()) , m_value(value) { } - inline NumberNode::NumberNode(JSGlobalData* globalData, double value) - : ExpressionNode(globalData, ResultType::numberType()) + inline NumberNode::NumberNode(const JSTokenLocation& location, double value) + : ConstantNode(location, JSValue(value).isInt32() ? ResultType::numberTypeIsInt32() : ResultType::numberType()) , m_value(value) { } - inline StringNode::StringNode(JSGlobalData* globalData, const Identifier& value) - : ExpressionNode(globalData, ResultType::stringType()) + inline StringNode::StringNode(const JSTokenLocation& location, const Identifier& value) + : ConstantNode(location, ResultType::stringType()) , m_value(value) { } - inline RegExpNode::RegExpNode(JSGlobalData* globalData, const Identifier& pattern, const Identifier& flags) - : ExpressionNode(globalData) + inline RegExpNode::RegExpNode(const JSTokenLocation& location, const Identifier& pattern, const Identifier& flags) + : ExpressionNode(location) , m_pattern(pattern) , m_flags(flags) { } - inline ThisNode::ThisNode(JSGlobalData* globalData) - : ExpressionNode(globalData) + inline ThisNode::ThisNode(const JSTokenLocation& location) + : ExpressionNode(location) { } - inline ResolveNode::ResolveNode(JSGlobalData* globalData, const Identifier& ident, int startOffset) - : ExpressionNode(globalData) +inline ResolveNode::ResolveNode(const JSTokenLocation& location, const Identifier& ident, const JSTextPosition& start) + : ExpressionNode(location) , m_ident(ident) - , m_startOffset(startOffset) + , m_start(start) { + ASSERT(m_start.offset >= m_start.lineStartOffset); } - inline ElementNode::ElementNode(JSGlobalData*, int elision, ExpressionNode* node) + inline ElementNode::ElementNode(int elision, ExpressionNode* node) : m_next(0) , m_elision(elision) , m_node(node) { } - inline ElementNode::ElementNode(JSGlobalData*, ElementNode* l, int elision, ExpressionNode* node) + inline ElementNode::ElementNode(ElementNode* l, int elision, ExpressionNode* node) : m_next(0) , m_elision(elision) , m_node(node) @@ -116,323 +123,282 @@ namespace JSC { l->m_next = this; } - inline ArrayNode::ArrayNode(JSGlobalData* globalData, int elision) - : ExpressionNode(globalData) + inline ArrayNode::ArrayNode(const JSTokenLocation& location, int elision) + : ExpressionNode(location) , m_element(0) , m_elision(elision) , m_optional(true) { } - inline ArrayNode::ArrayNode(JSGlobalData* globalData, ElementNode* element) - : ExpressionNode(globalData) + inline ArrayNode::ArrayNode(const JSTokenLocation& location, ElementNode* element) + : ExpressionNode(location) , m_element(element) , m_elision(0) , m_optional(false) { } - inline ArrayNode::ArrayNode(JSGlobalData* globalData, int elision, ElementNode* element) - : ExpressionNode(globalData) + inline ArrayNode::ArrayNode(const JSTokenLocation& location, int elision, ElementNode* element) + : ExpressionNode(location) , m_element(element) , m_elision(elision) , m_optional(true) { } - inline PropertyNode::PropertyNode(JSGlobalData*, const Identifier& name, ExpressionNode* assign, Type type) - : m_name(name) + inline PropertyNode::PropertyNode(VM*, const Identifier& name, ExpressionNode* assign, Type type) + : m_name(&name) , m_assign(assign) , m_type(type) { } - inline PropertyNode::PropertyNode(JSGlobalData* globalData, double name, ExpressionNode* assign, Type type) - : m_name(globalData->parser->arena().identifierArena().makeNumericIdentifier(globalData, name)) + inline PropertyNode::PropertyNode(VM* vm, double name, ExpressionNode* assign, Type type) + : m_name(&vm->parserArena->identifierArena().makeNumericIdentifier(vm, name)) + , m_assign(assign) + , m_type(type) + { + } + + inline PropertyNode::PropertyNode(VM*, ExpressionNode* name, ExpressionNode* assign, Type type) + : m_name(0) + , m_expression(name) , m_assign(assign) , m_type(type) { } - inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node) - : Node(globalData) + inline PropertyListNode::PropertyListNode(const JSTokenLocation& location, PropertyNode* node) + : ExpressionNode(location) , m_node(node) , m_next(0) { } - inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node, PropertyListNode* list) - : Node(globalData) + inline PropertyListNode::PropertyListNode(const JSTokenLocation& location, PropertyNode* node, PropertyListNode* list) + : ExpressionNode(location) , m_node(node) , m_next(0) { list->m_next = this; } - inline ObjectLiteralNode::ObjectLiteralNode(JSGlobalData* globalData) - : ExpressionNode(globalData) + inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation& location) + : ExpressionNode(location) , m_list(0) { } - inline ObjectLiteralNode::ObjectLiteralNode(JSGlobalData* globalData, PropertyListNode* list) - : ExpressionNode(globalData) + inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation& location, PropertyListNode* list) + : ExpressionNode(location) , m_list(list) { } - inline BracketAccessorNode::BracketAccessorNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments) - : ExpressionNode(globalData) + inline BracketAccessorNode::BracketAccessorNode(const JSTokenLocation& location, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments) + : ExpressionNode(location) , m_base(base) , m_subscript(subscript) , m_subscriptHasAssignments(subscriptHasAssignments) { } - inline DotAccessorNode::DotAccessorNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident) - : ExpressionNode(globalData) + inline DotAccessorNode::DotAccessorNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident) + : ExpressionNode(location) , m_base(base) , m_ident(ident) { } + + + inline SpreadExpressionNode::SpreadExpressionNode(const JSTokenLocation& location, ExpressionNode* expression) + : ExpressionNode(location) + , m_expression(expression) + { + } - inline ArgumentListNode::ArgumentListNode(JSGlobalData* globalData, ExpressionNode* expr) - : Node(globalData) + inline ArgumentListNode::ArgumentListNode(const JSTokenLocation& location, ExpressionNode* expr) + : ExpressionNode(location) , m_next(0) , m_expr(expr) { } - inline ArgumentListNode::ArgumentListNode(JSGlobalData* globalData, ArgumentListNode* listNode, ExpressionNode* expr) - : Node(globalData) + inline ArgumentListNode::ArgumentListNode(const JSTokenLocation& location, ArgumentListNode* listNode, ExpressionNode* expr) + : ExpressionNode(location) , m_next(0) , m_expr(expr) { listNode->m_next = this; } - inline ArgumentsNode::ArgumentsNode(JSGlobalData*) + inline ArgumentsNode::ArgumentsNode() : m_listNode(0) { } - inline ArgumentsNode::ArgumentsNode(JSGlobalData*, ArgumentListNode* listNode) + inline ArgumentsNode::ArgumentsNode(ArgumentListNode* listNode) : m_listNode(listNode) { } - inline NewExprNode::NewExprNode(JSGlobalData* globalData, ExpressionNode* expr) - : ExpressionNode(globalData) + inline NewExprNode::NewExprNode(const JSTokenLocation& location, ExpressionNode* expr) + : ExpressionNode(location) , m_expr(expr) , m_args(0) { } - inline NewExprNode::NewExprNode(JSGlobalData* globalData, ExpressionNode* expr, ArgumentsNode* args) - : ExpressionNode(globalData) + inline NewExprNode::NewExprNode(const JSTokenLocation& location, ExpressionNode* expr, ArgumentsNode* args) + : ExpressionNode(location) , m_expr(expr) , m_args(args) { } - inline EvalFunctionCallNode::EvalFunctionCallNode(JSGlobalData* globalData, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableExpressionData(divot, startOffset, endOffset) + inline EvalFunctionCallNode::EvalFunctionCallNode(const JSTokenLocation& location, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowableExpressionData(divot, divotStart, divotEnd) , m_args(args) { } - inline FunctionCallValueNode::FunctionCallValueNode(JSGlobalData* globalData, ExpressionNode* expr, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableExpressionData(divot, startOffset, endOffset) + inline FunctionCallValueNode::FunctionCallValueNode(const JSTokenLocation& location, ExpressionNode* expr, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowableExpressionData(divot, divotStart, divotEnd) , m_expr(expr) , m_args(args) { + ASSERT(divot.offset >= divotStart.offset); } - inline FunctionCallResolveNode::FunctionCallResolveNode(JSGlobalData* globalData, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableExpressionData(divot, startOffset, endOffset) + inline FunctionCallResolveNode::FunctionCallResolveNode(const JSTokenLocation& location, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowableExpressionData(divot, divotStart, divotEnd) , m_ident(ident) , m_args(args) { } - inline FunctionCallBracketNode::FunctionCallBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableSubExpressionData(divot, startOffset, endOffset) + inline FunctionCallBracketNode::FunctionCallBracketNode(const JSTokenLocation& location, ExpressionNode* base, ExpressionNode* subscript, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowableSubExpressionData(divot, divotStart, divotEnd) , m_base(base) , m_subscript(subscript) , m_args(args) { } - inline FunctionCallDotNode::FunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableSubExpressionData(divot, startOffset, endOffset) + inline FunctionCallDotNode::FunctionCallDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowableSubExpressionData(divot, divotStart, divotEnd) , m_base(base) , m_ident(ident) , m_args(args) { } - inline CallFunctionCallDotNode::CallFunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) - : FunctionCallDotNode(globalData, base, ident, args, divot, startOffset, endOffset) - { - } - - inline ApplyFunctionCallDotNode::ApplyFunctionCallDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset) - : FunctionCallDotNode(globalData, base, ident, args, divot, startOffset, endOffset) - { - } - - inline PrePostResolveNode::PrePostResolveNode(JSGlobalData* globalData, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData, ResultType::numberType()) // could be reusable for pre? - , ThrowableExpressionData(divot, startOffset, endOffset) - , m_ident(ident) - { - } - - inline PostfixResolveNode::PostfixResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) - : PrePostResolveNode(globalData, ident, divot, startOffset, endOffset) - , m_operator(oper) - { - } - - inline PostfixBracketNode::PostfixBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableSubExpressionData(divot, startOffset, endOffset) - , m_base(base) - , m_subscript(subscript) - , m_operator(oper) + inline CallFunctionCallDotNode::CallFunctionCallDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : FunctionCallDotNode(location, base, ident, args, divot, divotStart, divotEnd) { } - inline PostfixDotNode::PostfixDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableSubExpressionData(divot, startOffset, endOffset) - , m_base(base) - , m_ident(ident) - , m_operator(oper) + inline ApplyFunctionCallDotNode::ApplyFunctionCallDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : FunctionCallDotNode(location, base, ident, args, divot, divotStart, divotEnd) { } - inline PostfixErrorNode::PostfixErrorNode(JSGlobalData* globalData, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableSubExpressionData(divot, startOffset, endOffset) - , m_expr(expr) - , m_operator(oper) + inline PostfixNode::PostfixNode(const JSTokenLocation& location, ExpressionNode* expr, Operator oper, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : PrefixNode(location, expr, oper, divot, divotStart, divotEnd) { } - inline DeleteResolveNode::DeleteResolveNode(JSGlobalData* globalData, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableExpressionData(divot, startOffset, endOffset) + inline DeleteResolveNode::DeleteResolveNode(const JSTokenLocation& location, const Identifier& ident, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowableExpressionData(divot, divotStart, divotEnd) , m_ident(ident) { } - inline DeleteBracketNode::DeleteBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableExpressionData(divot, startOffset, endOffset) + inline DeleteBracketNode::DeleteBracketNode(const JSTokenLocation& location, ExpressionNode* base, ExpressionNode* subscript, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowableExpressionData(divot, divotStart, divotEnd) , m_base(base) , m_subscript(subscript) { } - inline DeleteDotNode::DeleteDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableExpressionData(divot, startOffset, endOffset) + inline DeleteDotNode::DeleteDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowableExpressionData(divot, divotStart, divotEnd) , m_base(base) , m_ident(ident) { } - inline DeleteValueNode::DeleteValueNode(JSGlobalData* globalData, ExpressionNode* expr) - : ExpressionNode(globalData) + inline DeleteValueNode::DeleteValueNode(const JSTokenLocation& location, ExpressionNode* expr) + : ExpressionNode(location) , m_expr(expr) { } - inline VoidNode::VoidNode(JSGlobalData* globalData, ExpressionNode* expr) - : ExpressionNode(globalData) + inline VoidNode::VoidNode(const JSTokenLocation& location, ExpressionNode* expr) + : ExpressionNode(location) , m_expr(expr) { } - inline TypeOfResolveNode::TypeOfResolveNode(JSGlobalData* globalData, const Identifier& ident) - : ExpressionNode(globalData, ResultType::stringType()) + inline TypeOfResolveNode::TypeOfResolveNode(const JSTokenLocation& location, const Identifier& ident) + : ExpressionNode(location, ResultType::stringType()) , m_ident(ident) { } - inline TypeOfValueNode::TypeOfValueNode(JSGlobalData* globalData, ExpressionNode* expr) - : ExpressionNode(globalData, ResultType::stringType()) + inline TypeOfValueNode::TypeOfValueNode(const JSTokenLocation& location, ExpressionNode* expr) + : ExpressionNode(location, ResultType::stringType()) , m_expr(expr) { } - inline PrefixResolveNode::PrefixResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) - : PrePostResolveNode(globalData, ident, divot, startOffset, endOffset) - , m_operator(oper) - { - } - - inline PrefixBracketNode::PrefixBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset) - , m_base(base) - , m_subscript(subscript) - , m_operator(oper) - { - } - - inline PrefixDotNode::PrefixDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset) - , m_base(base) - , m_ident(ident) - , m_operator(oper) - { - } - - inline PrefixErrorNode::PrefixErrorNode(JSGlobalData* globalData, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableExpressionData(divot, startOffset, endOffset) + inline PrefixNode::PrefixNode(const JSTokenLocation& location, ExpressionNode* expr, Operator oper, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowablePrefixedSubExpressionData(divot, divotStart, divotEnd) , m_expr(expr) , m_operator(oper) { } - inline UnaryOpNode::UnaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr, OpcodeID opcodeID) - : ExpressionNode(globalData, type) + inline UnaryOpNode::UnaryOpNode(const JSTokenLocation& location, ResultType type, ExpressionNode* expr, OpcodeID opcodeID) + : ExpressionNode(location, type) , m_expr(expr) , m_opcodeID(opcodeID) { } - inline UnaryPlusNode::UnaryPlusNode(JSGlobalData* globalData, ExpressionNode* expr) - : UnaryOpNode(globalData, ResultType::numberType(), expr, op_to_jsnumber) + inline UnaryPlusNode::UnaryPlusNode(const JSTokenLocation& location, ExpressionNode* expr) + : UnaryOpNode(location, ResultType::numberType(), expr, op_to_number) { } - inline NegateNode::NegateNode(JSGlobalData* globalData, ExpressionNode* expr) - : UnaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr, op_negate) + inline NegateNode::NegateNode(const JSTokenLocation& location, ExpressionNode* expr) + : UnaryOpNode(location, ResultType::numberType(), expr, op_negate) { } - inline BitwiseNotNode::BitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr) - : UnaryOpNode(globalData, ResultType::forBitOp(), expr, op_bitnot) + inline BitwiseNotNode::BitwiseNotNode(const JSTokenLocation& location, ExpressionNode* expr) + : ExpressionNode(location, ResultType::forBitOp()) + , m_expr(expr) { } - inline LogicalNotNode::LogicalNotNode(JSGlobalData* globalData, ExpressionNode* expr) - : UnaryOpNode(globalData, ResultType::booleanType(), expr, op_not) + inline LogicalNotNode::LogicalNotNode(const JSTokenLocation& location, ExpressionNode* expr) + : UnaryOpNode(location, ResultType::booleanType(), expr, op_not) { } - inline BinaryOpNode::BinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) - : ExpressionNode(globalData) + inline BinaryOpNode::BinaryOpNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) + : ExpressionNode(location) , m_expr1(expr1) , m_expr2(expr2) , m_opcodeID(opcodeID) @@ -440,8 +406,8 @@ namespace JSC { { } - inline BinaryOpNode::BinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) - : ExpressionNode(globalData, type) + inline BinaryOpNode::BinaryOpNode(const JSTokenLocation& location, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) + : ExpressionNode(location, type) , m_expr1(expr1) , m_expr2(expr2) , m_opcodeID(opcodeID) @@ -449,151 +415,141 @@ namespace JSC { { } - inline ReverseBinaryOpNode::ReverseBinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) - : BinaryOpNode(globalData, expr1, expr2, opcodeID, rightHasAssignments) + inline MultNode::MultNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_mul, rightHasAssignments) { } - inline ReverseBinaryOpNode::ReverseBinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) - : BinaryOpNode(globalData, type, expr1, expr2, opcodeID, rightHasAssignments) + inline DivNode::DivNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_div, rightHasAssignments) { } - inline MultNode::MultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_mul, rightHasAssignments) - { - } - inline DivNode::DivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_div, rightHasAssignments) + inline ModNode::ModNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_mod, rightHasAssignments) { } - - inline ModNode::ModNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_mod, rightHasAssignments) + inline AddNode::AddNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::forAdd(expr1->resultDescriptor(), expr2->resultDescriptor()), expr1, expr2, op_add, rightHasAssignments) { } - inline AddNode::AddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::forAdd(expr1->resultDescriptor(), expr2->resultDescriptor()), expr1, expr2, op_add, rightHasAssignments) + inline SubNode::SubNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_sub, rightHasAssignments) { } - inline SubNode::SubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_sub, rightHasAssignments) + inline LeftShiftNode::LeftShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_lshift, rightHasAssignments) { } - inline LeftShiftNode::LeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_lshift, rightHasAssignments) + inline RightShiftNode::RightShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_rshift, rightHasAssignments) { } - inline RightShiftNode::RightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_rshift, rightHasAssignments) + inline UnsignedRightShiftNode::UnsignedRightShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_urshift, rightHasAssignments) { } - inline UnsignedRightShiftNode::UnsignedRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::numberTypeCanReuse(), expr1, expr2, op_urshift, rightHasAssignments) + inline LessNode::LessNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments) { } - inline LessNode::LessNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments) + inline GreaterNode::GreaterNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_greater, rightHasAssignments) { } - inline GreaterNode::GreaterNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : ReverseBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments) + inline LessEqNode::LessEqNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments) { } - inline LessEqNode::LessEqNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments) + inline GreaterEqNode::GreaterEqNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_greatereq, rightHasAssignments) { } - inline GreaterEqNode::GreaterEqNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : ReverseBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments) + inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(const JSTokenLocation& location, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) + : BinaryOpNode(location, type, expr1, expr2, opcodeID, rightHasAssignments) { } - inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(JSGlobalData* globalData, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) - : BinaryOpNode(globalData, type, expr1, expr2, opcodeID, rightHasAssignments) + inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) + : BinaryOpNode(location, expr1, expr2, opcodeID, rightHasAssignments) { } - inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) - : BinaryOpNode(globalData, expr1, expr2, opcodeID, rightHasAssignments) + inline InstanceOfNode::InstanceOfNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : ThrowableBinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_instanceof, rightHasAssignments) { } - inline InstanceOfNode::InstanceOfNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : ThrowableBinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_instanceof, rightHasAssignments) + inline InNode::InNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : ThrowableBinaryOpNode(location, expr1, expr2, op_in, rightHasAssignments) { } - inline InNode::InNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : ThrowableBinaryOpNode(globalData, expr1, expr2, op_in, rightHasAssignments) + inline EqualNode::EqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_eq, rightHasAssignments) { } - inline EqualNode::EqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_eq, rightHasAssignments) + inline NotEqualNode::NotEqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_neq, rightHasAssignments) { } - inline NotEqualNode::NotEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_neq, rightHasAssignments) + inline StrictEqualNode::StrictEqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_stricteq, rightHasAssignments) { } - inline StrictEqualNode::StrictEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_stricteq, rightHasAssignments) + inline NotStrictEqualNode::NotStrictEqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_nstricteq, rightHasAssignments) { } - inline NotStrictEqualNode::NotStrictEqualNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::booleanType(), expr1, expr2, op_nstricteq, rightHasAssignments) + inline BitAndNode::BitAndNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_bitand, rightHasAssignments) { } - inline BitAndNode::BitAndNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitand, rightHasAssignments) + inline BitOrNode::BitOrNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_bitor, rightHasAssignments) { } - inline BitOrNode::BitOrNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitor, rightHasAssignments) + inline BitXOrNode::BitXOrNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) + : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_bitxor, rightHasAssignments) { } - inline BitXOrNode::BitXOrNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) - : BinaryOpNode(globalData, ResultType::forBitOp(), expr1, expr2, op_bitxor, rightHasAssignments) - { - } - - inline LogicalOpNode::LogicalOpNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator oper) - : ExpressionNode(globalData, ResultType::booleanType()) + inline LogicalOpNode::LogicalOpNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator oper) + : ExpressionNode(location, ResultType::forLogicalOp(expr1->resultDescriptor(), expr2->resultDescriptor())) , m_expr1(expr1) , m_expr2(expr2) , m_operator(oper) { } - inline ConditionalNode::ConditionalNode(JSGlobalData* globalData, ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2) - : ExpressionNode(globalData) + inline ConditionalNode::ConditionalNode(const JSTokenLocation& location, ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2) + : ExpressionNode(location) , m_logical(logical) , m_expr1(expr1) , m_expr2(expr2) { } - inline ReadModifyResolveNode::ReadModifyResolveNode(JSGlobalData* globalData, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableExpressionData(divot, startOffset, endOffset) + inline ReadModifyResolveNode::ReadModifyResolveNode(const JSTokenLocation& location, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowableExpressionData(divot, divotStart, divotEnd) , m_ident(ident) , m_right(right) , m_operator(oper) @@ -601,17 +557,17 @@ namespace JSC { { } - inline AssignResolveNode::AssignResolveNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments) - : ExpressionNode(globalData) + inline AssignResolveNode::AssignResolveNode(const JSTokenLocation& location, const Identifier& ident, ExpressionNode* right) + : ExpressionNode(location) , m_ident(ident) , m_right(right) - , m_rightHasAssignments(rightHasAssignments) { } - inline ReadModifyBracketNode::ReadModifyBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, Operator oper, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableSubExpressionData(divot, startOffset, endOffset) + + 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) + : ExpressionNode(location) + , ThrowableSubExpressionData(divot, divotStart, divotEnd) , m_base(base) , m_subscript(subscript) , m_right(right) @@ -621,9 +577,9 @@ namespace JSC { { } - inline AssignBracketNode::AssignBracketNode(JSGlobalData* globalData, ExpressionNode* base, ExpressionNode* subscript, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableExpressionData(divot, startOffset, endOffset) + 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) + : ExpressionNode(location) + , ThrowableExpressionData(divot, divotStart, divotEnd) , m_base(base) , m_subscript(subscript) , m_right(right) @@ -632,9 +588,9 @@ namespace JSC { { } - inline AssignDotNode::AssignDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableExpressionData(divot, startOffset, endOffset) + inline AssignDotNode::AssignDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowableExpressionData(divot, divotStart, divotEnd) , m_base(base) , m_ident(ident) , m_right(right) @@ -642,9 +598,9 @@ namespace JSC { { } - inline ReadModifyDotNode::ReadModifyDotNode(JSGlobalData* globalData, ExpressionNode* base, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableSubExpressionData(divot, startOffset, endOffset) + 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) + : ExpressionNode(location) + , ThrowableSubExpressionData(divot, divotStart, divotEnd) , m_base(base) , m_ident(ident) , m_right(right) @@ -653,124 +609,117 @@ namespace JSC { { } - inline AssignErrorNode::AssignErrorNode(JSGlobalData* globalData, ExpressionNode* left, Operator oper, ExpressionNode* right, unsigned divot, unsigned startOffset, unsigned endOffset) - : ExpressionNode(globalData) - , ThrowableExpressionData(divot, startOffset, endOffset) - , m_left(left) - , m_operator(oper) - , m_right(right) + inline AssignErrorNode::AssignErrorNode(const JSTokenLocation& location, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) + : ExpressionNode(location) + , ThrowableExpressionData(divot, divotStart, divotEnd) { } - inline CommaNode::CommaNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2) - : ExpressionNode(globalData) + inline CommaNode::CommaNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2) + : ExpressionNode(location) { + ASSERT(expr1); + ASSERT(expr2); m_expressions.append(expr1); m_expressions.append(expr2); } - inline ConstStatementNode::ConstStatementNode(JSGlobalData* globalData, ConstDeclNode* next) - : StatementNode(globalData) + inline ConstStatementNode::ConstStatementNode(const JSTokenLocation& location, ConstDeclNode* next) + : StatementNode(location) , m_next(next) { } - inline SourceElements::SourceElements(JSGlobalData*) + inline SourceElements::SourceElements() { } - inline EmptyStatementNode::EmptyStatementNode(JSGlobalData* globalData) - : StatementNode(globalData) + inline EmptyStatementNode::EmptyStatementNode(const JSTokenLocation& location) + : StatementNode(location) { } - inline DebuggerStatementNode::DebuggerStatementNode(JSGlobalData* globalData) - : StatementNode(globalData) + inline DebuggerStatementNode::DebuggerStatementNode(const JSTokenLocation& location) + : StatementNode(location) { } - inline ExprStatementNode::ExprStatementNode(JSGlobalData* globalData, ExpressionNode* expr) - : StatementNode(globalData) + inline ExprStatementNode::ExprStatementNode(const JSTokenLocation& location, ExpressionNode* expr) + : StatementNode(location) , m_expr(expr) { } - inline VarStatementNode::VarStatementNode(JSGlobalData* globalData, ExpressionNode* expr) - : StatementNode(globalData) + inline VarStatementNode::VarStatementNode(const JSTokenLocation& location, ExpressionNode* expr) + : StatementNode(location) , m_expr(expr) { } - inline IfNode::IfNode(JSGlobalData* globalData, ExpressionNode* condition, StatementNode* ifBlock) - : StatementNode(globalData) + inline IfElseNode::IfElseNode(const JSTokenLocation& location, ExpressionNode* condition, StatementNode* ifBlock, StatementNode* elseBlock) + : StatementNode(location) , m_condition(condition) , m_ifBlock(ifBlock) - { - } - - inline IfElseNode::IfElseNode(JSGlobalData* globalData, ExpressionNode* condition, StatementNode* ifBlock, StatementNode* elseBlock) - : IfNode(globalData, condition, ifBlock) , m_elseBlock(elseBlock) { } - inline DoWhileNode::DoWhileNode(JSGlobalData* globalData, StatementNode* statement, ExpressionNode* expr) - : StatementNode(globalData) + inline DoWhileNode::DoWhileNode(const JSTokenLocation& location, StatementNode* statement, ExpressionNode* expr) + : StatementNode(location) , m_statement(statement) , m_expr(expr) { } - inline WhileNode::WhileNode(JSGlobalData* globalData, ExpressionNode* expr, StatementNode* statement) - : StatementNode(globalData) + inline WhileNode::WhileNode(const JSTokenLocation& location, ExpressionNode* expr, StatementNode* statement) + : StatementNode(location) , m_expr(expr) , m_statement(statement) { } - inline ForNode::ForNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode* statement, bool expr1WasVarDecl) - : StatementNode(globalData) + inline ForNode::ForNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode* statement) + : StatementNode(location) , m_expr1(expr1) , m_expr2(expr2) , m_expr3(expr3) , m_statement(statement) - , m_expr1WasVarDecl(expr1 && expr1WasVarDecl) { ASSERT(statement); } - inline ContinueNode::ContinueNode(JSGlobalData* globalData) - : StatementNode(globalData) - , m_ident(globalData->propertyNames->nullIdentifier) + inline ContinueNode::ContinueNode(VM* vm, const JSTokenLocation& location) + : StatementNode(location) + , m_ident(vm->propertyNames->nullIdentifier) { } - inline ContinueNode::ContinueNode(JSGlobalData* globalData, const Identifier& ident) - : StatementNode(globalData) + inline ContinueNode::ContinueNode(const JSTokenLocation& location, const Identifier& ident) + : StatementNode(location) , m_ident(ident) { } - inline BreakNode::BreakNode(JSGlobalData* globalData) - : StatementNode(globalData) - , m_ident(globalData->propertyNames->nullIdentifier) + inline BreakNode::BreakNode(VM* vm, const JSTokenLocation& location) + : StatementNode(location) + , m_ident(vm->propertyNames->nullIdentifier) { } - inline BreakNode::BreakNode(JSGlobalData* globalData, const Identifier& ident) - : StatementNode(globalData) + inline BreakNode::BreakNode(const JSTokenLocation& location, const Identifier& ident) + : StatementNode(location) , m_ident(ident) { } - inline ReturnNode::ReturnNode(JSGlobalData* globalData, ExpressionNode* value) - : StatementNode(globalData) + inline ReturnNode::ReturnNode(const JSTokenLocation& location, ExpressionNode* value) + : StatementNode(location) , m_value(value) { } - inline WithNode::WithNode(JSGlobalData* globalData, ExpressionNode* expr, StatementNode* statement, uint32_t divot, uint32_t expressionLength) - : StatementNode(globalData) + inline WithNode::WithNode(const JSTokenLocation& location, ExpressionNode* expr, StatementNode* statement, const JSTextPosition& divot, uint32_t expressionLength) + : StatementNode(location) , m_expr(expr) , m_statement(statement) , m_divot(divot) @@ -778,131 +727,187 @@ namespace JSC { { } - inline LabelNode::LabelNode(JSGlobalData* globalData, const Identifier& name, StatementNode* statement) - : StatementNode(globalData) + inline LabelNode::LabelNode(const JSTokenLocation& location, const Identifier& name, StatementNode* statement) + : StatementNode(location) , m_name(name) , m_statement(statement) { } - inline ThrowNode::ThrowNode(JSGlobalData* globalData, ExpressionNode* expr) - : StatementNode(globalData) + inline ThrowNode::ThrowNode(const JSTokenLocation& location, ExpressionNode* expr) + : StatementNode(location) , m_expr(expr) { } - inline TryNode::TryNode(JSGlobalData* globalData, StatementNode* tryBlock, const Identifier& exceptionIdent, bool catchHasEval, StatementNode* catchBlock, StatementNode* finallyBlock) - : StatementNode(globalData) + inline TryNode::TryNode(const JSTokenLocation& location, StatementNode* tryBlock, const Identifier& exceptionIdent, StatementNode* catchBlock, StatementNode* finallyBlock) + : StatementNode(location) , m_tryBlock(tryBlock) , m_exceptionIdent(exceptionIdent) , m_catchBlock(catchBlock) , m_finallyBlock(finallyBlock) - , m_catchHasEval(catchHasEval) { } - inline ParameterNode::ParameterNode(JSGlobalData*, const Identifier& ident) - : m_ident(ident) + inline ParameterNode::ParameterNode(PassRefPtr pattern) + : m_pattern(pattern) , m_next(0) { + ASSERT(m_pattern); } - inline ParameterNode::ParameterNode(JSGlobalData*, ParameterNode* l, const Identifier& ident) - : m_ident(ident) + inline ParameterNode::ParameterNode(ParameterNode* l, PassRefPtr pattern) + : m_pattern(pattern) , m_next(0) { l->m_next = this; + ASSERT(m_pattern); + ASSERT(l->m_pattern); } - inline FuncExprNode::FuncExprNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter) - : ExpressionNode(globalData) + inline FuncExprNode::FuncExprNode(const JSTokenLocation& location, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter) + : ExpressionNode(location) , m_body(body) { - m_body->finishParsing(source, parameter, ident); + m_body->finishParsing(source, parameter, ident, FunctionExpression); } - inline FuncDeclNode::FuncDeclNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter) - : StatementNode(globalData) + inline FuncDeclNode::FuncDeclNode(const JSTokenLocation& location, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter) + : StatementNode(location) , m_body(body) { - m_body->finishParsing(source, parameter, ident); + m_body->finishParsing(source, parameter, ident, FunctionDeclaration); } - inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr, SourceElements* statements) + inline CaseClauseNode::CaseClauseNode(ExpressionNode* expr, SourceElements* statements) : m_expr(expr) , m_statements(statements) { } - inline ClauseListNode::ClauseListNode(JSGlobalData*, CaseClauseNode* clause) + inline ClauseListNode::ClauseListNode(CaseClauseNode* clause) : m_clause(clause) , m_next(0) { } - inline ClauseListNode::ClauseListNode(JSGlobalData*, ClauseListNode* clauseList, CaseClauseNode* clause) + inline ClauseListNode::ClauseListNode(ClauseListNode* clauseList, CaseClauseNode* clause) : m_clause(clause) , m_next(0) { clauseList->m_next = this; } - inline CaseBlockNode::CaseBlockNode(JSGlobalData*, ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2) + inline CaseBlockNode::CaseBlockNode(ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2) : m_list1(list1) , m_defaultClause(defaultClause) , m_list2(list2) { } - inline SwitchNode::SwitchNode(JSGlobalData* globalData, ExpressionNode* expr, CaseBlockNode* block) - : StatementNode(globalData) + inline SwitchNode::SwitchNode(const JSTokenLocation& location, ExpressionNode* expr, CaseBlockNode* block) + : StatementNode(location) , m_expr(expr) , m_block(block) { } - inline ConstDeclNode::ConstDeclNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* init) - : ExpressionNode(globalData) + inline ConstDeclNode::ConstDeclNode(const JSTokenLocation& location, const Identifier& ident, ExpressionNode* init) + : ExpressionNode(location) , m_ident(ident) , m_next(0) , m_init(init) { } - inline BlockNode::BlockNode(JSGlobalData* globalData, SourceElements* statements) - : StatementNode(globalData) + inline BlockNode::BlockNode(const JSTokenLocation& location, SourceElements* statements) + : StatementNode(location) , m_statements(statements) { } - inline ForInNode::ForInNode(JSGlobalData* globalData, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement) - : StatementNode(globalData) - , m_ident(globalData->propertyNames->nullIdentifier) - , m_init(0) + inline EnumerationNode::EnumerationNode(const JSTokenLocation& location, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement) + : StatementNode(location) , m_lexpr(l) , m_expr(expr) , m_statement(statement) - , m_identIsVarDecl(false) { + ASSERT(l); } - - inline ForInNode::ForInNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* in, ExpressionNode* expr, StatementNode* statement, int divot, int startOffset, int endOffset) - : StatementNode(globalData) - , m_ident(ident) - , m_init(0) - , m_lexpr(new (globalData) ResolveNode(globalData, ident, divot - startOffset)) + + inline EnumerationNode::EnumerationNode(VM* vm, const JSTokenLocation& location, DeconstructionPatternNode* pattern, ExpressionNode* expr, StatementNode* statement) + : StatementNode(location) + , m_lexpr(new (vm) DeconstructingAssignmentNode(location, pattern, 0)) , m_expr(expr) , m_statement(statement) - , m_identIsVarDecl(true) { - if (in) { - AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, ident, in, true); - node->setExceptionSourceCode(divot, divot - startOffset, endOffset - divot); - m_init = node; - } - // for( var foo = bar in baz ) + ASSERT(pattern); + } + + inline ForInNode::ForInNode(const JSTokenLocation& location, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement) + : EnumerationNode(location, l, expr, statement) + { + } + + inline ForInNode::ForInNode(VM* vm, const JSTokenLocation& location, DeconstructionPatternNode* pattern, ExpressionNode* expr, StatementNode* statement) + : EnumerationNode(vm, location, pattern, expr, statement) + { + } + + inline ForOfNode::ForOfNode(const JSTokenLocation& location, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement) + : EnumerationNode(location, l, expr, statement) + { + } + + inline ForOfNode::ForOfNode(VM* vm, const JSTokenLocation& location, DeconstructionPatternNode* pattern, ExpressionNode* expr, StatementNode* statement) + : EnumerationNode(vm, location, pattern, expr, statement) + { + } + + inline DeconstructionPatternNode::DeconstructionPatternNode(VM*) + { } + inline ArrayPatternNode::ArrayPatternNode(VM* vm) + : DeconstructionPatternNode(vm) + { + } + + inline PassRefPtr ArrayPatternNode::create(VM* vm) + { + return adoptRef(new ArrayPatternNode(vm)); + } + + inline ObjectPatternNode::ObjectPatternNode(VM* vm) + : DeconstructionPatternNode(vm) + { + } + + inline PassRefPtr ObjectPatternNode::create(VM* vm) + { + return adoptRef(new ObjectPatternNode(vm)); + } + + inline PassRefPtr BindingNode::create(VM* vm, const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end) + { + return adoptRef(new BindingNode(vm, boundProperty, start, end)); + } + + inline BindingNode::BindingNode(VM* vm, const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end) + : DeconstructionPatternNode(vm) + , m_divotStart(start) + , m_divotEnd(end) + , m_boundProperty(boundProperty) + { + } + + inline DeconstructingAssignmentNode::DeconstructingAssignmentNode(const JSTokenLocation& location, PassRefPtr bindings, ExpressionNode* initializer) + : ExpressionNode(location) + , m_bindings(bindings) + , m_initializer(initializer) + { + } + } // namespace JSC #endif // NodeConstructors_h