Changeset 3313 in webkit for trunk/JavaScriptCore/kjs/nodes2string.cpp
- Timestamp:
- Jan 13, 2003, 7:49:23 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/nodes2string.cpp
r3215 r3313 82 82 SourceStream& SourceStream::operator<<(Format f) 83 83 { 84 if (f == Endl) 85 str += "\n" + ind; 86 else if (f == Indent) 87 ind += " "; 88 else 89 ind = ind.substr(0, ind.size() - 2); 84 switch (f) { 85 case Endl: 86 str += "\n" + ind; 87 break; 88 case Indent: 89 ind += " "; 90 break; 91 case Unindent: 92 ind = ind.substr(0, ind.size() - 2); 93 break; 94 } 90 95 91 96 return *this; … … 122 127 void ElementNode::streamTo(SourceStream &s) const 123 128 { 124 for ( int i = 0; i < elision; i++)125 s << ",";126 s << node;127 if (list)128 s << "," << list;129 for (const ElementNode *n = this; n; n = n->list) { 130 for (int i = 0; i < n->elision; i++) 131 s << ","; 132 s << n->node; 133 } 129 134 } 130 135 … … 147 152 void PropertyValueNode::streamTo(SourceStream &s) const 148 153 { 149 s << name << ": " << assign; 150 if (list) 151 s << ", " << list; 154 for (const PropertyValueNode *n = this; n; n = n->list) 155 s << n->name << ": " << n->assign; 152 156 } 153 157 … … 173 177 { 174 178 s << expr; 175 if (list)176 s << ", " << list;179 for (ArgumentListNode *n = list; n; n = n->list) 180 s << ", " << n->expr; 177 181 } 178 182 … … 389 393 void StatListNode::streamTo(SourceStream &s) const 390 394 { 391 s << list << statement; 395 for (const StatListNode *n = this; n; n = n->list) 396 s << n->statement; 392 397 } 393 398 … … 405 410 { 406 411 s << var; 407 if (list)408 s << ", " << list;412 for (VarDeclListNode *n = list; n; n = n->list) 413 s << ", " << n->var; 409 414 } 410 415 … … 517 522 void ClauseListNode::streamTo(SourceStream &s) const 518 523 { 519 const ClauseListNode *l = this; 520 do { 521 s << l; 522 l = l->nx; 523 } while (l); 524 for (const ClauseListNode *n = this; n; n = n->next()) 525 s << n->clause(); 524 526 } 525 527 526 528 void CaseBlockNode::streamTo(SourceStream &s) const 527 529 { 528 const ClauseListNode *cl = list1; 529 while (cl) { 530 s << cl->clause(); 531 cl = cl->next(); 532 } 530 for (const ClauseListNode *n = list1; n; n = n->next()) 531 s << n->clause(); 533 532 if (def) 534 533 s << def; 535 cl = list2; 536 while (cl) { 537 s << cl->clause(); 538 cl = cl->next(); 539 } 534 for (const ClauseListNode *n = list2; n; n = n->next()) 535 s << n->clause(); 540 536 } 541 537 … … 578 574 { 579 575 s << id; 580 if (next)581 s << ", " << n ext;576 for (ParameterNode *n = next; n; n = n->next) 577 s << ", " << n->id; 582 578 } 583 579 … … 598 594 void SourceElementsNode::streamTo(SourceStream &s) const 599 595 { 600 s << elements << element; 601 } 602 596 for (const SourceElementsNode *n = this; n; n = n->elements) 597 s << n->element; 598 } 599
Note:
See TracChangeset
for help on using the changeset viewer.