]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - parser/NodeConstructors.h
JavaScriptCore-1218.0.1.tar.gz
[apple/javascriptcore.git] / parser / NodeConstructors.h
index e496d2342b3401fa4ae74e246394eb97c33bca1f..47f6eea0927aac2a04cff958a2770cb95af1e207 100644 (file)
@@ -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
 
 namespace JSC {
 
-    inline void* ParserArenaFreeable::operator new(size_t size, JSGlobalData* globalData)
+    inline void* ParserArenaFreeable::operator new(size_t size, VM* vm)
     {
-        return globalData->parserArena->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->parserArena->allocateDeletable(size);
+        return vm->parserArena->allocateDeletable(size);
     }
 
-    inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData* globalData)
+    inline ParserArenaRefCounted::ParserArenaRefCounted(VM* vm)
     {
-        globalData->parserArena->derefWithArena(adoptRef(this));
+        vm->parserArena->derefWithArena(adoptRef(this));
     }
 
-    inline Node::Node(int lineNumber)
-        : m_lineNumber(lineNumber)
+    inline Node::Node(const JSTokenLocation& location)
+        : m_lineNumber(location.line)
+        , m_startOffset(location.startOffset)
+        , m_lineStartOffset(location.lineStartOffset)
     {
+        ASSERT(location.startOffset >= location.lineStartOffset);
     }
 
-    inline ExpressionNode::ExpressionNode(int lineNumber, ResultType resultType)
-        : Node(lineNumber)
+    inline ExpressionNode::ExpressionNode(const JSTokenLocation& location, ResultType resultType)
+        : Node(location)
         , m_resultType(resultType)
     {
     }
 
-    inline StatementNode::StatementNode(int lineNumber)
-        : Node(lineNumber)
+    inline StatementNode::StatementNode(const JSTokenLocation& location)
+        : Node(location)
         , m_lastLine(-1)
     {
     }
 
-    inline NullNode::NullNode(int lineNumber)
-        : ExpressionNode(lineNumber, ResultType::nullType())
+    inline ConstantNode::ConstantNode(const JSTokenLocation& location, ResultType resultType)
+        : ExpressionNode(location, resultType)
     {
     }
 
-    inline BooleanNode::BooleanNode(int lineNumber, bool value)
-        : ExpressionNode(lineNumber, 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(int lineNumber, double value)
-        : ExpressionNode(lineNumber, 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(int lineNumber, const Identifier& value)
-        : ExpressionNode(lineNumber, ResultType::stringType())
+    inline StringNode::StringNode(const JSTokenLocation& location, const Identifier& value)
+        : ConstantNode(location, ResultType::stringType())
         , m_value(value)
     {
     }
 
-    inline RegExpNode::RegExpNode(int lineNumber, const Identifier& pattern, const Identifier& flags)
-        : ExpressionNode(lineNumber)
+    inline RegExpNode::RegExpNode(const JSTokenLocation& location, const Identifier& pattern, const Identifier& flags)
+        : ExpressionNode(location)
         , m_pattern(pattern)
         , m_flags(flags)
     {
     }
 
-    inline ThisNode::ThisNode(int lineNumber)
-        : ExpressionNode(lineNumber)
+    inline ThisNode::ThisNode(const JSTokenLocation& location)
+        : ExpressionNode(location)
     {
     }
 
-    inline ResolveNode::ResolveNode(int lineNumber, const Identifier& ident, int startOffset)
-        : ExpressionNode(lineNumber)
+inline ResolveNode::ResolveNode(const JSTokenLocation& location, const Identifier& ident, unsigned startOffset, unsigned divotLine, unsigned divotLineStart)
+        : ExpressionNode(location)
         , m_ident(ident)
         , m_startOffset(startOffset)
+        , m_divotLine(divotLine)
+        , m_divotLineStart(divotLineStart)
     {
+        ASSERT(m_startOffset >= m_divotLineStart);
     }
 
     inline ElementNode::ElementNode(int elision, ExpressionNode* node)
@@ -116,95 +127,95 @@ namespace JSC {
         l->m_next = this;
     }
 
-    inline ArrayNode::ArrayNode(int lineNumber, int elision)
-        : ExpressionNode(lineNumber)
+    inline ArrayNode::ArrayNode(const JSTokenLocation& location, int elision)
+        : ExpressionNode(location)
         , m_element(0)
         , m_elision(elision)
         , m_optional(true)
     {
     }
 
-    inline ArrayNode::ArrayNode(int lineNumber, ElementNode* element)
-        : ExpressionNode(lineNumber)
+    inline ArrayNode::ArrayNode(const JSTokenLocation& location, ElementNode* element)
+        : ExpressionNode(location)
         , m_element(element)
         , m_elision(0)
         , m_optional(false)
     {
     }
 
-    inline ArrayNode::ArrayNode(int lineNumber, int elision, ElementNode* element)
-        : ExpressionNode(lineNumber)
+    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)
+    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->parserArena->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 PropertyListNode::PropertyListNode(int lineNumber, PropertyNode* node)
-        : Node(lineNumber)
+    inline PropertyListNode::PropertyListNode(const JSTokenLocation& location, PropertyNode* node)
+        : ExpressionNode(location)
         , m_node(node)
         , m_next(0)
     {
     }
 
-    inline PropertyListNode::PropertyListNode(int lineNumber, PropertyNode* node, PropertyListNode* list)
-        : Node(lineNumber)
+    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(int lineNumber)
-        : ExpressionNode(lineNumber)
+    inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation& location)
+        : ExpressionNode(location)
         , m_list(0)
     {
     }
 
-    inline ObjectLiteralNode::ObjectLiteralNode(int lineNumber, PropertyListNode* list)
-        : ExpressionNode(lineNumber)
+    inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation& location, PropertyListNode* list)
+        : ExpressionNode(location)
         , m_list(list)
     {
     }
 
-    inline BracketAccessorNode::BracketAccessorNode(int lineNumber, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments)
-        : ExpressionNode(lineNumber)
+    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(int lineNumber, ExpressionNode* base, const Identifier& ident)
-        : ExpressionNode(lineNumber)
+    inline DotAccessorNode::DotAccessorNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident)
+        : ExpressionNode(location)
         , m_base(base)
         , m_ident(ident)
     {
     }
 
-    inline ArgumentListNode::ArgumentListNode(int lineNumber, ExpressionNode* expr)
-        : Node(lineNumber)
+    inline ArgumentListNode::ArgumentListNode(const JSTokenLocation& location, ExpressionNode* expr)
+        : ExpressionNode(location)
         , m_next(0)
         , m_expr(expr)
     {
     }
 
-    inline ArgumentListNode::ArgumentListNode(int lineNumber, ArgumentListNode* listNode, ExpressionNode* expr)
-        : Node(lineNumber)
+    inline ArgumentListNode::ArgumentListNode(const JSTokenLocation& location, ArgumentListNode* listNode, ExpressionNode* expr)
+        : ExpressionNode(location)
         , m_next(0)
         , m_expr(expr)
     {
@@ -221,219 +232,162 @@ namespace JSC {
     {
     }
 
-    inline NewExprNode::NewExprNode(int lineNumber, ExpressionNode* expr)
-        : ExpressionNode(lineNumber)
+    inline NewExprNode::NewExprNode(const JSTokenLocation& location, ExpressionNode* expr)
+        : ExpressionNode(location)
         , m_expr(expr)
         , m_args(0)
     {
     }
 
-    inline NewExprNode::NewExprNode(int lineNumber, ExpressionNode* expr, ArgumentsNode* args)
-        : ExpressionNode(lineNumber)
+    inline NewExprNode::NewExprNode(const JSTokenLocation& location, ExpressionNode* expr, ArgumentsNode* args)
+        : ExpressionNode(location)
         , m_expr(expr)
         , m_args(args)
     {
     }
 
-    inline EvalFunctionCallNode::EvalFunctionCallNode(int lineNumber, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableExpressionData(divot, startOffset, endOffset)
+    inline EvalFunctionCallNode::EvalFunctionCallNode(const JSTokenLocation& location, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : ExpressionNode(location)
+        , ThrowableExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_args(args)
     {
+        ASSERT(divot >= divotLineStart);
     }
 
-    inline FunctionCallValueNode::FunctionCallValueNode(int lineNumber, ExpressionNode* expr, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableExpressionData(divot, startOffset, endOffset)
+    inline FunctionCallValueNode::FunctionCallValueNode(const JSTokenLocation& location, ExpressionNode* expr, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : ExpressionNode(location)
+        , ThrowableExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_expr(expr)
         , m_args(args)
     {
     }
 
-    inline FunctionCallResolveNode::FunctionCallResolveNode(int lineNumber, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableExpressionData(divot, startOffset, endOffset)
+    inline FunctionCallResolveNode::FunctionCallResolveNode(const JSTokenLocation& location, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : ExpressionNode(location)
+        , ThrowableExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_ident(ident)
         , m_args(args)
     {
     }
 
-    inline FunctionCallBracketNode::FunctionCallBracketNode(int lineNumber, ExpressionNode* base, ExpressionNode* subscript, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableSubExpressionData(divot, startOffset, endOffset)
+    inline FunctionCallBracketNode::FunctionCallBracketNode(const JSTokenLocation& location, ExpressionNode* base, ExpressionNode* subscript, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : ExpressionNode(location)
+        , ThrowableSubExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_base(base)
         , m_subscript(subscript)
         , m_args(args)
     {
     }
 
-    inline FunctionCallDotNode::FunctionCallDotNode(int lineNumber, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableSubExpressionData(divot, startOffset, endOffset)
+    inline FunctionCallDotNode::FunctionCallDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : ExpressionNode(location)
+        , ThrowableSubExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_base(base)
         , m_ident(ident)
         , m_args(args)
     {
     }
 
-    inline CallFunctionCallDotNode::CallFunctionCallDotNode(int lineNumber, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : FunctionCallDotNode(lineNumber, base, ident, args, divot, startOffset, endOffset)
-    {
-    }
-
-    inline ApplyFunctionCallDotNode::ApplyFunctionCallDotNode(int lineNumber, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : FunctionCallDotNode(lineNumber, base, ident, args, divot, startOffset, endOffset)
-    {
-    }
-
-    inline PrePostResolveNode::PrePostResolveNode(int lineNumber, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber, ResultType::numberType()) // could be reusable for pre?
-        , ThrowableExpressionData(divot, startOffset, endOffset)
-        , m_ident(ident)
-    {
-    }
-
-    inline PostfixResolveNode::PostfixResolveNode(int lineNumber, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : PrePostResolveNode(lineNumber, ident, divot, startOffset, endOffset)
-        , m_operator(oper)
-    {
-    }
-
-    inline PostfixBracketNode::PostfixBracketNode(int lineNumber, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , 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, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : FunctionCallDotNode(location, base, ident, args, divot, startOffset, endOffset, divotLine, divotLineStart)
     {
     }
 
-    inline PostfixDotNode::PostfixDotNode(int lineNumber, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , 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, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : FunctionCallDotNode(location, base, ident, args, divot, startOffset, endOffset, divotLine, divotLineStart)
     {
     }
 
-    inline PostfixErrorNode::PostfixErrorNode(int lineNumber, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableSubExpressionData(divot, startOffset, endOffset)
-        , m_expr(expr)
-        , m_operator(oper)
+    inline PostfixNode::PostfixNode(const JSTokenLocation& location, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : PrefixNode(location, expr, oper, divot, startOffset, endOffset, divotLine, divotLineStart)
     {
     }
 
-    inline DeleteResolveNode::DeleteResolveNode(int lineNumber, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableExpressionData(divot, startOffset, endOffset)
+    inline DeleteResolveNode::DeleteResolveNode(const JSTokenLocation& location, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : ExpressionNode(location)
+        , ThrowableExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_ident(ident)
     {
     }
 
-    inline DeleteBracketNode::DeleteBracketNode(int lineNumber, ExpressionNode* base, ExpressionNode* subscript, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableExpressionData(divot, startOffset, endOffset)
+    inline DeleteBracketNode::DeleteBracketNode(const JSTokenLocation& location, ExpressionNode* base, ExpressionNode* subscript, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : ExpressionNode(location)
+        , ThrowableExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_base(base)
         , m_subscript(subscript)
     {
     }
 
-    inline DeleteDotNode::DeleteDotNode(int lineNumber, ExpressionNode* base, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableExpressionData(divot, startOffset, endOffset)
+    inline DeleteDotNode::DeleteDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : ExpressionNode(location)
+        , ThrowableExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_base(base)
         , m_ident(ident)
     {
     }
 
-    inline DeleteValueNode::DeleteValueNode(int lineNumber, ExpressionNode* expr)
-        : ExpressionNode(lineNumber)
+    inline DeleteValueNode::DeleteValueNode(const JSTokenLocation& location, ExpressionNode* expr)
+        : ExpressionNode(location)
         , m_expr(expr)
     {
     }
 
-    inline VoidNode::VoidNode(int lineNumber, ExpressionNode* expr)
-        : ExpressionNode(lineNumber)
+    inline VoidNode::VoidNode(const JSTokenLocation& location, ExpressionNode* expr)
+        : ExpressionNode(location)
         , m_expr(expr)
     {
     }
 
-    inline TypeOfResolveNode::TypeOfResolveNode(int lineNumber, const Identifier& ident)
-        : ExpressionNode(lineNumber, ResultType::stringType())
+    inline TypeOfResolveNode::TypeOfResolveNode(const JSTokenLocation& location, const Identifier& ident)
+        : ExpressionNode(location, ResultType::stringType())
         , m_ident(ident)
     {
     }
 
-    inline TypeOfValueNode::TypeOfValueNode(int lineNumber, ExpressionNode* expr)
-        : ExpressionNode(lineNumber, ResultType::stringType())
+    inline TypeOfValueNode::TypeOfValueNode(const JSTokenLocation& location, ExpressionNode* expr)
+        : ExpressionNode(location, ResultType::stringType())
         , m_expr(expr)
     {
     }
 
-    inline PrefixResolveNode::PrefixResolveNode(int lineNumber, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : PrePostResolveNode(lineNumber, ident, divot, startOffset, endOffset)
-        , m_operator(oper)
-    {
-    }
-
-    inline PrefixBracketNode::PrefixBracketNode(int lineNumber, ExpressionNode* base, ExpressionNode* subscript, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset)
-        , m_base(base)
-        , m_subscript(subscript)
-        , m_operator(oper)
-    {
-    }
-
-    inline PrefixDotNode::PrefixDotNode(int lineNumber, ExpressionNode* base, const Identifier& ident, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset)
-        , m_base(base)
-        , m_ident(ident)
-        , m_operator(oper)
-    {
-    }
-
-    inline PrefixErrorNode::PrefixErrorNode(int lineNumber, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableExpressionData(divot, startOffset, endOffset)
+    inline PrefixNode::PrefixNode(const JSTokenLocation& location, ExpressionNode* expr, Operator oper, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : ExpressionNode(location)
+        , ThrowablePrefixedSubExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_expr(expr)
         , m_operator(oper)
     {
     }
 
-    inline UnaryOpNode::UnaryOpNode(int lineNumber, ResultType type, ExpressionNode* expr, OpcodeID opcodeID)
-        : ExpressionNode(lineNumber, 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(int lineNumber, ExpressionNode* expr)
-        : UnaryOpNode(lineNumber, 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(int lineNumber, ExpressionNode* expr)
-        : UnaryOpNode(lineNumber, ResultType::numberType(), expr, op_negate)
+    inline NegateNode::NegateNode(const JSTokenLocation& location, ExpressionNode* expr)
+        : UnaryOpNode(location, ResultType::numberType(), expr, op_negate)
     {
     }
 
-    inline BitwiseNotNode::BitwiseNotNode(int lineNumber, ExpressionNode* expr)
-        : ExpressionNode(lineNumber, ResultType::forBitOp())
+    inline BitwiseNotNode::BitwiseNotNode(const JSTokenLocation& location, ExpressionNode* expr)
+        : ExpressionNode(location, ResultType::forBitOp())
         , m_expr(expr)
     {
     }
 
-    inline LogicalNotNode::LogicalNotNode(int lineNumber, ExpressionNode* expr)
-        : UnaryOpNode(lineNumber, ResultType::booleanType(), expr, op_not)
+    inline LogicalNotNode::LogicalNotNode(const JSTokenLocation& location, ExpressionNode* expr)
+        : UnaryOpNode(location, ResultType::booleanType(), expr, op_not)
     {
     }
 
-    inline BinaryOpNode::BinaryOpNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
-        : ExpressionNode(lineNumber)
+    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)
@@ -441,8 +395,8 @@ namespace JSC {
     {
     }
 
-    inline BinaryOpNode::BinaryOpNode(int lineNumber, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
-        : ExpressionNode(lineNumber, 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)
@@ -450,159 +404,160 @@ namespace JSC {
     {
     }
 
-    inline MultNode::MultNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::numberType(), expr1, expr2, op_mul, rightHasAssignments)
+    inline MultNode::MultNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_mul, rightHasAssignments)
     {
     }
 
-    inline DivNode::DivNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::numberType(), expr1, expr2, op_div, rightHasAssignments)
+    inline DivNode::DivNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_div, rightHasAssignments)
     {
     }
 
 
-    inline ModNode::ModNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::numberType(), expr1, expr2, op_mod, rightHasAssignments)
+    inline ModNode::ModNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_mod, rightHasAssignments)
     {
     }
 
-    inline AddNode::AddNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::forAdd(expr1->resultDescriptor(), expr2->resultDescriptor()), expr1, expr2, op_add, 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 SubNode::SubNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::numberType(), expr1, expr2, op_sub, rightHasAssignments)
+    inline SubNode::SubNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_sub, rightHasAssignments)
     {
     }
 
-    inline LeftShiftNode::LeftShiftNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::forBitOp(), expr1, expr2, op_lshift, rightHasAssignments)
+    inline LeftShiftNode::LeftShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_lshift, rightHasAssignments)
     {
     }
 
-    inline RightShiftNode::RightShiftNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::forBitOp(), expr1, expr2, op_rshift, rightHasAssignments)
+    inline RightShiftNode::RightShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_rshift, rightHasAssignments)
     {
     }
 
-    inline UnsignedRightShiftNode::UnsignedRightShiftNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::numberType(), expr1, expr2, op_urshift, rightHasAssignments)
+    inline UnsignedRightShiftNode::UnsignedRightShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_urshift, rightHasAssignments)
     {
     }
 
-    inline LessNode::LessNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments)
+    inline LessNode::LessNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments)
     {
     }
 
-    inline GreaterNode::GreaterNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::booleanType(), expr1, expr2, op_greater, rightHasAssignments)
+    inline GreaterNode::GreaterNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_greater, rightHasAssignments)
     {
     }
 
-    inline LessEqNode::LessEqNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments)
+    inline LessEqNode::LessEqNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments)
     {
     }
 
-    inline GreaterEqNode::GreaterEqNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::booleanType(), expr1, expr2, op_greatereq, rightHasAssignments)
+    inline GreaterEqNode::GreaterEqNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_greatereq, rightHasAssignments)
     {
     }
 
-    inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(int lineNumber, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, type, expr1, expr2, opcodeID, 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(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, 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 InstanceOfNode::InstanceOfNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : ThrowableBinaryOpNode(lineNumber, ResultType::booleanType(), expr1, expr2, op_instanceof, rightHasAssignments)
+    inline InstanceOfNode::InstanceOfNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : ThrowableBinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_instanceof, rightHasAssignments)
     {
     }
 
-    inline InNode::InNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : ThrowableBinaryOpNode(lineNumber, expr1, expr2, op_in, rightHasAssignments)
+    inline InNode::InNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : ThrowableBinaryOpNode(location, expr1, expr2, op_in, rightHasAssignments)
     {
     }
 
-    inline EqualNode::EqualNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::booleanType(), expr1, expr2, op_eq, rightHasAssignments)
+    inline EqualNode::EqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_eq, rightHasAssignments)
     {
     }
 
-    inline NotEqualNode::NotEqualNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::booleanType(), expr1, expr2, op_neq, rightHasAssignments)
+    inline NotEqualNode::NotEqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_neq, rightHasAssignments)
     {
     }
 
-    inline StrictEqualNode::StrictEqualNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::booleanType(), expr1, expr2, op_stricteq, rightHasAssignments)
+    inline StrictEqualNode::StrictEqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_stricteq, rightHasAssignments)
     {
     }
 
-    inline NotStrictEqualNode::NotStrictEqualNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::booleanType(), expr1, expr2, op_nstricteq, rightHasAssignments)
+    inline NotStrictEqualNode::NotStrictEqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_nstricteq, rightHasAssignments)
     {
     }
 
-    inline BitAndNode::BitAndNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::forBitOp(), expr1, expr2, op_bitand, rightHasAssignments)
+    inline BitAndNode::BitAndNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_bitand, rightHasAssignments)
     {
     }
 
-    inline BitOrNode::BitOrNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::forBitOp(), expr1, expr2, op_bitor, rightHasAssignments)
+    inline BitOrNode::BitOrNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_bitor, rightHasAssignments)
     {
     }
 
-    inline BitXOrNode::BitXOrNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
-        : BinaryOpNode(lineNumber, ResultType::forBitOp(), expr1, expr2, op_bitxor, rightHasAssignments)
+    inline BitXOrNode::BitXOrNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
+        : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_bitxor, rightHasAssignments)
     {
     }
 
-    inline LogicalOpNode::LogicalOpNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator oper)
-        : ExpressionNode(lineNumber, ResultType::booleanType())
+    inline LogicalOpNode::LogicalOpNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator oper)
+        : ExpressionNode(location, ResultType::booleanType())
         , m_expr1(expr1)
         , m_expr2(expr2)
         , m_operator(oper)
     {
     }
 
-    inline ConditionalNode::ConditionalNode(int lineNumber, ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2)
-        : ExpressionNode(lineNumber)
+    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(int lineNumber, const Identifier& ident, Operator oper, ExpressionNode*  right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableExpressionData(divot, startOffset, endOffset)
+    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)
+        : ExpressionNode(location)
+        , ThrowableExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_ident(ident)
         , m_right(right)
         , m_operator(oper)
         , m_rightHasAssignments(rightHasAssignments)
     {
+        ASSERT(divot >= divotLineStart);
+        ASSERT(divot - startOffset >= divotLineStart);
     }
 
-    inline AssignResolveNode::AssignResolveNode(int lineNumber, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments)
-        : ExpressionNode(lineNumber)
+    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(int lineNumber, ExpressionNode* base, ExpressionNode* subscript, Operator oper, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableSubExpressionData(divot, startOffset, endOffset)
+    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)
+        : ExpressionNode(location)
+        , ThrowableSubExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_base(base)
         , m_subscript(subscript)
         , m_right(right)
@@ -612,9 +567,9 @@ namespace JSC {
     {
     }
 
-    inline AssignBracketNode::AssignBracketNode(int lineNumber, ExpressionNode* base, ExpressionNode* subscript, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableExpressionData(divot, startOffset, endOffset)
+    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)
+        : ExpressionNode(location)
+        , ThrowableExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_base(base)
         , m_subscript(subscript)
         , m_right(right)
@@ -623,9 +578,9 @@ namespace JSC {
     {
     }
 
-    inline AssignDotNode::AssignDotNode(int lineNumber, ExpressionNode* base, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableExpressionData(divot, startOffset, endOffset)
+    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)
+        : ExpressionNode(location)
+        , ThrowableExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_base(base)
         , m_ident(ident)
         , m_right(right)
@@ -633,9 +588,9 @@ namespace JSC {
     {
     }
 
-    inline ReadModifyDotNode::ReadModifyDotNode(int lineNumber, ExpressionNode* base, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableSubExpressionData(divot, startOffset, endOffset)
+    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)
+        : ExpressionNode(location)
+        , ThrowableSubExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
         , m_base(base)
         , m_ident(ident)
         , m_right(right)
@@ -644,24 +599,21 @@ namespace JSC {
     {
     }
 
-    inline AssignErrorNode::AssignErrorNode(int lineNumber, ExpressionNode* left, Operator oper, ExpressionNode* right, unsigned divot, unsigned startOffset, unsigned endOffset)
-        : ExpressionNode(lineNumber)
-        , ThrowableExpressionData(divot, startOffset, endOffset)
-        , m_left(left)
-        , m_operator(oper)
-        , m_right(right)
+    inline AssignErrorNode::AssignErrorNode(const JSTokenLocation& location, unsigned divot, unsigned startOffset, unsigned endOffset, unsigned divotLine, unsigned divotLineStart)
+        : ExpressionNode(location)
+        , ThrowableExpressionData(divot, startOffset, endOffset, divotLine, divotLineStart)
     {
     }
 
-    inline CommaNode::CommaNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2)
-        : ExpressionNode(lineNumber)
+    inline CommaNode::CommaNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2)
+        : ExpressionNode(location)
     {
         m_expressions.append(expr1);
         m_expressions.append(expr2);
     }
 
-    inline ConstStatementNode::ConstStatementNode(int lineNumber, ConstDeclNode* next)
-        : StatementNode(lineNumber)
+    inline ConstStatementNode::ConstStatementNode(const JSTokenLocation& location, ConstDeclNode* next)
+        : StatementNode(location)
         , m_next(next)
     {
     }
@@ -670,120 +622,116 @@ namespace JSC {
     {
     }
 
-    inline EmptyStatementNode::EmptyStatementNode(int lineNumber)
-        : StatementNode(lineNumber)
+    inline EmptyStatementNode::EmptyStatementNode(const JSTokenLocation& location)
+        : StatementNode(location)
     {
     }
 
-    inline DebuggerStatementNode::DebuggerStatementNode(int lineNumber)
-        : StatementNode(lineNumber)
+    inline DebuggerStatementNode::DebuggerStatementNode(const JSTokenLocation& location)
+        : StatementNode(location)
     {
     }
     
-    inline ExprStatementNode::ExprStatementNode(int lineNumber, ExpressionNode* expr)
-        : StatementNode(lineNumber)
+    inline ExprStatementNode::ExprStatementNode(const JSTokenLocation& location, ExpressionNode* expr)
+        : StatementNode(location)
         , m_expr(expr)
     {
     }
 
-    inline VarStatementNode::VarStatementNode(int lineNumber, ExpressionNode* expr)
-        : StatementNode(lineNumber)
+    inline VarStatementNode::VarStatementNode(const JSTokenLocation& location, ExpressionNode* expr)
+        : StatementNode(location)
         , m_expr(expr)
     {
     }
     
-    inline IfNode::IfNode(int lineNumber, ExpressionNode* condition, StatementNode* ifBlock)
-        : StatementNode(lineNumber)
+    inline IfElseNode::IfElseNode(const JSTokenLocation& location, ExpressionNode* condition, StatementNode* ifBlock, StatementNode* elseBlock)
+        : StatementNode(location)
         , m_condition(condition)
         , m_ifBlock(ifBlock)
-    {
-    }
-
-    inline IfElseNode::IfElseNode(int lineNumber, ExpressionNode* condition, StatementNode* ifBlock, StatementNode* elseBlock)
-        : IfNode(lineNumber, condition, ifBlock)
         , m_elseBlock(elseBlock)
     {
     }
 
-    inline DoWhileNode::DoWhileNode(int lineNumber, StatementNode* statement, ExpressionNode* expr)
-        : StatementNode(lineNumber)
+    inline DoWhileNode::DoWhileNode(const JSTokenLocation& location, StatementNode* statement, ExpressionNode* expr)
+        : StatementNode(location)
         , m_statement(statement)
         , m_expr(expr)
     {
     }
 
-    inline WhileNode::WhileNode(int lineNumber, ExpressionNode* expr, StatementNode* statement)
-        : StatementNode(lineNumber)
+    inline WhileNode::WhileNode(const JSTokenLocation& location, ExpressionNode* expr, StatementNode* statement)
+        : StatementNode(location)
         , m_expr(expr)
         , m_statement(statement)
     {
     }
 
-    inline ForNode::ForNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode* statement, bool expr1WasVarDecl)
-        : StatementNode(lineNumber)
+    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, int lineNumber)
-        : StatementNode(lineNumber)
-        , m_ident(globalData->propertyNames->nullIdentifier)
+    inline ContinueNode::ContinueNode(VM* vm, const JSTokenLocation& location)
+        : StatementNode(location)
+        , m_ident(vm->propertyNames->nullIdentifier)
     {
     }
 
-    inline ContinueNode::ContinueNode(int lineNumber, const Identifier& ident)
-        : StatementNode(lineNumber)
+    inline ContinueNode::ContinueNode(const JSTokenLocation& location, const Identifier& ident)
+        : StatementNode(location)
         , m_ident(ident)
     {
     }
     
-    inline BreakNode::BreakNode(JSGlobalData* globalData, int lineNumber)
-        : StatementNode(lineNumber)
-        , m_ident(globalData->propertyNames->nullIdentifier)
+    inline BreakNode::BreakNode(VM* vm, const JSTokenLocation& location)
+        : StatementNode(location)
+        , m_ident(vm->propertyNames->nullIdentifier)
     {
     }
 
-    inline BreakNode::BreakNode(int lineNumber, const Identifier& ident)
-        : StatementNode(lineNumber)
+    inline BreakNode::BreakNode(const JSTokenLocation& location, const Identifier& ident)
+        : StatementNode(location)
         , m_ident(ident)
     {
     }
     
-    inline ReturnNode::ReturnNode(int lineNumber, ExpressionNode* value)
-        : StatementNode(lineNumber)
+    inline ReturnNode::ReturnNode(const JSTokenLocation& location, ExpressionNode* value)
+        : StatementNode(location)
         , m_value(value)
     {
     }
 
-    inline WithNode::WithNode(int lineNumber, ExpressionNode* expr, StatementNode* statement, uint32_t divot, uint32_t expressionLength)
-        : StatementNode(lineNumber)
+    inline WithNode::WithNode(const JSTokenLocation& location, ExpressionNode* expr, StatementNode* statement, uint32_t divot, unsigned divotLine, unsigned divotLineStart, uint32_t expressionLength)
+        : StatementNode(location)
         , m_expr(expr)
         , m_statement(statement)
         , m_divot(divot)
+        , m_divotLine(divotLine)
+        , m_divotLineStart(divotLineStart)
         , m_expressionLength(expressionLength)
     {
     }
 
-    inline LabelNode::LabelNode(int lineNumber, const Identifier& name, StatementNode* statement)
-        : StatementNode(lineNumber)
+    inline LabelNode::LabelNode(const JSTokenLocation& location, const Identifier& name, StatementNode* statement)
+        : StatementNode(location)
         , m_name(name)
         , m_statement(statement)
     {
     }
 
-    inline ThrowNode::ThrowNode(int lineNumber, ExpressionNode* expr)
-        : StatementNode(lineNumber)
+    inline ThrowNode::ThrowNode(const JSTokenLocation& location, ExpressionNode* expr)
+        : StatementNode(location)
         , m_expr(expr)
     {
     }
 
-    inline TryNode::TryNode(int lineNumber, StatementNode* tryBlock, const Identifier& exceptionIdent, StatementNode* catchBlock, StatementNode* finallyBlock)
-        : StatementNode(lineNumber)
+    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)
@@ -804,18 +752,18 @@ namespace JSC {
         l->m_next = this;
     }
 
-    inline FuncExprNode::FuncExprNode(int lineNumber, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
-        : ExpressionNode(lineNumber)
+    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, FunctionNameIsInScope);
     }
 
-    inline FuncDeclNode::FuncDeclNode(int lineNumber, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter)
-        : StatementNode(lineNumber)
+    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, FunctionNameIsNotInScope);
     }
 
     inline CaseClauseNode::CaseClauseNode(ExpressionNode* expr, SourceElements* statements)
@@ -844,50 +792,47 @@ namespace JSC {
     {
     }
 
-    inline SwitchNode::SwitchNode(int lineNumber, ExpressionNode* expr, CaseBlockNode* block)
-        : StatementNode(lineNumber)
+    inline SwitchNode::SwitchNode(const JSTokenLocation& location, ExpressionNode* expr, CaseBlockNode* block)
+        : StatementNode(location)
         , m_expr(expr)
         , m_block(block)
     {
     }
 
-    inline ConstDeclNode::ConstDeclNode(int lineNumber, const Identifier& ident, ExpressionNode* init)
-        : ExpressionNode(lineNumber)
+    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(int lineNumber, SourceElements* statements)
-        : StatementNode(lineNumber)
+    inline BlockNode::BlockNode(const JSTokenLocation& location, SourceElements* statements)
+        : StatementNode(location)
         , m_statements(statements)
     {
     }
 
-    inline ForInNode::ForInNode(JSGlobalData* globalData, int lineNumber, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement)
-        : StatementNode(lineNumber)
-        , m_ident(globalData->propertyNames->nullIdentifier)
+    inline ForInNode::ForInNode(const JSTokenLocation& location, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement)
+        : StatementNode(location)
         , m_init(0)
         , m_lexpr(l)
         , m_expr(expr)
         , m_statement(statement)
-        , m_identIsVarDecl(false)
     {
     }
 
-    inline ForInNode::ForInNode(JSGlobalData* globalData, int lineNumber, const Identifier& ident, ExpressionNode* in, ExpressionNode* expr, StatementNode* statement, int divot, int startOffset, int endOffset)
-        : StatementNode(lineNumber)
-        , m_ident(ident)
+    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)
+        : StatementNode(location)
         , m_init(0)
-        , m_lexpr(new (globalData) ResolveNode(lineNumber, ident, divot - startOffset))
+        , m_lexpr(new (vm) ResolveNode(location, ident, divot - startOffset, divotLine, divotLineStart))
         , m_expr(expr)
         , m_statement(statement)
-        , m_identIsVarDecl(true)
     {
         if (in) {
-            AssignResolveNode* node = new (globalData) AssignResolveNode(lineNumber, ident, in, true);
-            node->setExceptionSourceCode(divot, divot - startOffset, endOffset - divot);
+            AssignResolveNode* node = new (vm) AssignResolveNode(location, ident, in);
+            ASSERT(divot >= divotLineStart);
+            node->setExceptionSourceCode(divot, divot - startOffset, endOffset - divot, divotLine, divotLineStart);
             m_init = node;
         }
         // for( var foo = bar in baz )