Changeset 12523 in webkit for trunk/JavaScriptCore/kjs/function.cpp
- Timestamp:
- Feb 2, 2006, 12:22:43 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function.cpp
r12317 r12523 51 51 class Parameter { 52 52 public: 53 Parameter(const Identifier &n) : name(n), next(0L) { } 54 ~Parameter() { delete next; } 53 Parameter(const Identifier &n) : name(n) { } 55 54 Identifier name; 56 Parameter *next;55 OwnPtr<Parameter> next; 57 56 }; 58 57 … … 66 65 FunctionImp::~FunctionImp() 67 66 { 68 delete param;69 67 } 70 68 … … 146 144 void FunctionImp::addParameter(const Identifier &n) 147 145 { 148 Parameter **p = ¶m;146 OwnPtr<Parameter> *p = ¶m; 149 147 while (*p) 150 148 p = &(*p)->next; 151 149 152 *p = new Parameter(n);150 p->set(new Parameter(n)); 153 151 } 154 152 … … 156 154 { 157 155 UString s; 158 const Parameter *p = param ;156 const Parameter *p = param.get(); 159 157 while (p) { 160 158 if (!s.isEmpty()) 161 159 s += ", "; 162 160 s += p->name.ustring(); 163 p = p->next ;161 p = p->next.get(); 164 162 } 165 163 … … 181 179 if (param) { 182 180 ListIterator it = args.begin(); 183 Parameter *p = param ;181 Parameter *p = param.get(); 184 182 JSValue *v = *it; 185 183 while (p) { … … 193 191 } else 194 192 variable->put(exec, p->name, jsUndefined()); 195 p = p->next ;193 p = p->next.get(); 196 194 } 197 195 } … … 224 222 { 225 223 FunctionImp *thisObj = static_cast<FunctionImp *>(slot.slotBase()); 226 const Parameter *p = thisObj->param ;224 const Parameter *p = thisObj->param.get(); 227 225 int count = 0; 228 226 while (p) { 229 227 ++count; 230 p = p->next ;228 p = p->next.get(); 231 229 } 232 230 return jsNumber(count); … … 274 272 { 275 273 int i = 0; 276 Parameter *p = param ;274 Parameter *p = param.get(); 277 275 278 276 if(!p) … … 280 278 281 279 // skip to the parameter we want 282 while (i++ < index && (p = p->next ))280 while (i++ < index && (p = p->next.get())) 283 281 ; 284 282 … … 289 287 290 288 // Are there any subsequent parameters with the same name? 291 while ((p = p->next ))289 while ((p = p->next.get())) 292 290 if (p->name == name) 293 291 return Identifier::null();
Note:
See TracChangeset
for help on using the changeset viewer.