Changeset 28577 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


Ignore:
Timestamp:
Dec 9, 2007, 8:05:56 PM (17 years ago)
Author:
Darin Adler
Message:

Reviewed by Maciej.

Test: fast/js/exception-linenums-in-html-1.html
Test: fast/js/exception-linenums-in-html-2.html
Test: fast/js/exception-linenums.html

By the time the ProgramNode was constructed, the source URL was empty.

  • kjs/Parser.cpp: (KJS::Parser::parseProgram): Added code to set and clear m_sourceURL, which is now handled here instead of in the lexer; it needs to still be set when we create the program node. Call setLoc to set the first and last line number. (KJS::Parser::parseFunctionBody): Ditto, but for the body. (KJS::Parser::parse): Removed the sourceURL argument.
  • kjs/Parser.h: Added sourceURL(), m_sourceURL, and m_lastLine. Added a lastLine parameter to didFinishParsing, since the bison grammar knows the last line number and we otherwise do not know it. Removed the sourceURL parameter from parse, since that's now handled at a higher level.
  • kjs/grammar.y: Pass the last line number to didFinishParsing.
  • kjs/lexer.cpp: (KJS::Lexer::setCode): Removed the sourceURL argument and the code to set m_sourceURL. (KJS::Lexer::clear): Ditto.
  • kjs/lexer.h: More of the same.
  • kjs/nodes.cpp: (KJS::FunctionBodyNode::FunctionBodyNode): Get the source URL from the parser rather than from the lexer. Removed unneeded call to setLoc, since the line numbers already both default to -1.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r28551 r28577  
    44034403FunctionBodyNode::FunctionBodyNode(SourceElements* children)
    44044404    : BlockNode(children)
    4405     , m_sourceURL(lexer().sourceURL())
     4405    , m_sourceURL(parser().sourceURL())
    44064406    , m_sourceId(parser().sourceId())
    44074407    , m_initializedDeclarationStacks(false)
     
    44094409    , m_optimizedResolveNodes(false)
    44104410{
    4411   setLoc(-1, -1);
    44124411}
    44134412
Note: See TracChangeset for help on using the changeset viewer.