Changeset 28973 in webkit for trunk/JavaScriptCore/kjs/nodes2string.cpp
- Timestamp:
- Dec 24, 2007, 2:13:00 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/nodes2string.cpp
r28937 r28973 708 708 } 709 709 710 void AssignExprNode::streamTo(SourceStream& s) const711 { 712 s << " = " << PrecAssignment << expr;713 } 714 715 void VarDeclNode::streamTo(SourceStream& s) const 716 { 717 s << "var " << ident << init;718 for (VarDeclNode* n = next.get(); n; n = n->next.get())719 s << ", " << ident << init;720 } 721 722 void VarStatementNode::streamTo(SourceStream& s) const723 { 724 s << Endl << next << ';';710 void ConstDeclNode::streamTo(SourceStream& s) const 711 { 712 s << ident; 713 if (init) 714 s << " = " << init; 715 for (ConstDeclNode* n = next.get(); n; n = n->next.get()) { 716 s << ", " << ident; 717 if (init) 718 s << " = " << init; 719 } 720 } 721 722 void ConstStatementNode::streamTo(SourceStream& s) const 723 { 724 s << Endl << "const " << next << ';'; 725 725 } 726 726 … … 738 738 } 739 739 740 void ScopeNode::streamTo(SourceStream& s) const 741 { 742 s << Endl << "{" << Indent; 743 744 bool printedVar = false; 745 for (size_t i = 0; i < m_varStack.size(); ++i) { 746 if (m_varStack[i].second == 0) { 747 if (!printedVar) { 748 s << Endl << "var "; 749 printedVar = true; 750 } else 751 s << ", "; 752 s << m_varStack[i].first; 753 } 754 } 755 if (printedVar) 756 s << ';'; 757 758 statementListStreamTo(m_children, s); 759 s << Unindent << Endl << "}"; 760 } 761 740 762 void EmptyStatementNode::streamTo(SourceStream& s) const 741 763 { … … 746 768 { 747 769 s << Endl << expr << ';'; 770 } 771 772 void VarStatementNode::streamTo(SourceStream& s) const 773 { 774 s << Endl << "var " << expr << ';'; 748 775 } 749 776 … … 773 800 { 774 801 s << Endl << "for (" 802 << (expr1WasVarDecl ? "var " : "") 775 803 << expr1 776 804 << "; " << expr2 … … 782 810 { 783 811 s << Endl << "for ("; 784 if (varDecl) 785 s << varDecl; 786 else 812 if (identIsVarDecl) { 813 s << "var "; 814 if (init) 815 s << init; 816 else 817 s << PrecLeftHandSide << lexpr; 818 } else 787 819 s << PrecLeftHandSide << lexpr; 788 820
Note:
See TracChangeset
for help on using the changeset viewer.