Ignore:
Timestamp:
May 11, 2007, 9:45:45 AM (18 years ago)
Author:
bdash
Message:

2007-05-11 Kimmo Kinnunen <Kimmo Kinnunen>

Reviewed by Darin.

  • kjs/nodes2string.cpp: (VarDeclListNode::streamTo): Print "var " here (VarStatementNode::streamTo): Don't print "var " here (ForNode::streamTo): Remove TODO comment, VarDeclListNode will stream the "var " (ForInNode::streamTo): ForIn initializer is printed by VarDeclNode

2007-05-11 Kimmo Kinnunen <Kimmo Kinnunen>

Reviewed by Darin.

Testcase covers toString()ing functions with
for-statements of form for (var j = 1 in []) and for (var j=0;j<10;j++)

  • fast/js/resources/toString-for-var-decl.js: Added.
  • fast/js/toString-for-var-decl-expected.txt: Added.
  • fast/js/toString-for-var-decl.html: Added.
File:
1 edited

Legend:

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

    r21406 r21409  
    594594void VarDeclListNode::streamTo(SourceStream &s) const
    595595{
    596   s << var;
     596  s << "var " << var;
    597597  for (VarDeclListNode *n = next.get(); n; n = n->next.get())
    598598    s << ", " << n->var;
     
    601601void VarStatementNode::streamTo(SourceStream &s) const
    602602{
    603   s << SourceStream::Endl << "var " << next << ";";
     603  s << SourceStream::Endl << next << ";";
    604604}
    605605
     
    645645{
    646646  s << SourceStream::Endl << "for ("
    647     << expr1  // TODO: doesn't properly do "var i = 0"
     647    << expr1
    648648    << "; " << expr2
    649649    << "; " << expr3
     
    658658  else
    659659    s << lexpr;
    660  
    661   if (init)
    662     s << " = " << init;
     660
    663661  s << " in " << expr << ")" << SourceStream::Indent
    664662    << statement << SourceStream::Unindent;
Note: See TracChangeset for help on using the changeset viewer.