Changeset 10182 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Aug 14, 2005, 9:41:47 AM (20 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/internal.cpp
r10178 r10182 261 261 // ------------------------------ LabelStack ----------------------------------- 262 262 263 LabelStack::LabelStack(const LabelStack &other)264 {265 tos = 0;266 *this = other;267 }268 269 LabelStack &LabelStack::operator=(const LabelStack &other)270 {271 clear();272 tos = 0;273 StackElem *cur = 0;274 StackElem *se = other.tos;275 while (se) {276 StackElem *newPrev = new StackElem;277 newPrev->prev = 0;278 newPrev->id = se->id;279 if (cur)280 cur->prev = newPrev;281 else282 tos = newPrev;283 cur = newPrev;284 se = se->prev;285 }286 return *this;287 }288 289 263 bool LabelStack::push(const Identifier &id) 290 264 { … … 309 283 310 284 return false; 311 }312 313 void LabelStack::pop()314 {315 if (tos) {316 StackElem *prev = tos->prev;317 delete tos;318 tos = prev;319 }320 }321 322 LabelStack::~LabelStack()323 {324 clear();325 }326 327 void LabelStack::clear()328 {329 StackElem *prev;330 331 while (tos) {332 prev = tos->prev;333 delete tos;334 tos = prev;335 }336 285 } 337 286 … … 426 375 ProgramNode *prog = progNode; 427 376 progNode = 0; 428 // sid = -1;429 377 430 378 if (parseError || lexError) { -
trunk/JavaScriptCore/kjs/internal.h
r10178 r10182 140 140 ~LabelStack(); 141 141 142 LabelStack(const LabelStack &other);143 LabelStack &operator=(const LabelStack &other);144 145 142 /** 146 143 * If id is not empty and is not in the stack already, puts it on top of … … 166 163 167 164 private: 165 LabelStack(const LabelStack &other); 166 LabelStack &operator=(const LabelStack &other); 167 168 168 struct StackElem { 169 169 Identifier id; … … 172 172 173 173 StackElem *tos; 174 void clear();175 174 int iterationDepth; 176 175 int switchDepth; … … 409 408 #endif 410 409 410 inline LabelStack::~LabelStack() 411 { 412 StackElem *prev; 413 for (StackElem *e = tos; e; e = prev) { 414 prev = e->prev; 415 delete e; 416 } 417 } 418 419 inline void LabelStack::pop() 420 { 421 if (StackElem *e = tos) { 422 tos = e->prev; 423 delete e; 424 } 425 } 426 411 427 } // namespace 412 428
Note:
See TracChangeset
for help on using the changeset viewer.