Changeset 36977 in webkit for trunk/JavaScriptCore/kjs/RegExpConstructor.cpp
- Timestamp:
- Sep 26, 2008, 7:36:15 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/RegExpConstructor.cpp
r36784 r36977 21 21 #include "config.h" 22 22 #include "RegExpConstructor.h" 23 #include "RegExpConstructor.lut.h"24 23 25 24 #include "ArrayPrototype.h" … … 35 34 namespace JSC { 36 35 36 static JSValue* regExpConstructorInput(ExecState*, const Identifier&, const PropertySlot&); 37 static JSValue* regExpConstructorMultiline(ExecState*, const Identifier&, const PropertySlot&); 38 static JSValue* regExpConstructorLastMatch(ExecState*, const Identifier&, const PropertySlot&); 39 static JSValue* regExpConstructorLastParen(ExecState*, const Identifier&, const PropertySlot&); 40 static JSValue* regExpConstructorLeftContext(ExecState*, const Identifier&, const PropertySlot&); 41 static JSValue* regExpConstructorRightContext(ExecState*, const Identifier&, const PropertySlot&); 42 static JSValue* regExpConstructorDollar1(ExecState*, const Identifier&, const PropertySlot&); 43 static JSValue* regExpConstructorDollar2(ExecState*, const Identifier&, const PropertySlot&); 44 static JSValue* regExpConstructorDollar3(ExecState*, const Identifier&, const PropertySlot&); 45 static JSValue* regExpConstructorDollar4(ExecState*, const Identifier&, const PropertySlot&); 46 static JSValue* regExpConstructorDollar5(ExecState*, const Identifier&, const PropertySlot&); 47 static JSValue* regExpConstructorDollar6(ExecState*, const Identifier&, const PropertySlot&); 48 static JSValue* regExpConstructorDollar7(ExecState*, const Identifier&, const PropertySlot&); 49 static JSValue* regExpConstructorDollar8(ExecState*, const Identifier&, const PropertySlot&); 50 static JSValue* regExpConstructorDollar9(ExecState*, const Identifier&, const PropertySlot&); 51 52 static void setRegExpConstructorInput(ExecState*, JSObject*, JSValue*); 53 static void setRegExpConstructorMultiline(ExecState*, JSObject*, JSValue*); 54 55 } // namespace JSC 56 57 #include "RegExpConstructor.lut.h" 58 59 namespace JSC { 60 37 61 ASSERT_CLASS_FITS_IN_CELL(RegExpConstructor); 38 62 … … 41 65 /* Source for RegExpConstructor.lut.h 42 66 @begin regExpConstructorTable 43 input RegExpConstructor::Input None44 $_ RegExpConstructor::Input DontEnum45 multiline RegExpConstructor::Multiline None46 $* RegExpConstructor::Multiline DontEnum47 lastMatch RegExpConstructor::LastMatch DontDelete|ReadOnly48 $& RegExpConstructor::LastMatch DontDelete|ReadOnly|DontEnum49 lastParen RegExpConstructor::LastParen DontDelete|ReadOnly50 $+ RegExpConstructor::LastParen DontDelete|ReadOnly|DontEnum51 leftContext RegExpConstructor::LeftContext DontDelete|ReadOnly52 $` RegExpConstructor::LeftContext DontDelete|ReadOnly|DontEnum53 rightContext RegExpConstructor::RightContext DontDelete|ReadOnly54 $' RegExpConstructor::RightContext DontDelete|ReadOnly|DontEnum55 $1 RegExpConstructor::Dollar1 DontDelete|ReadOnly56 $2 RegExpConstructor::Dollar2 DontDelete|ReadOnly57 $3 RegExpConstructor::Dollar3 DontDelete|ReadOnly58 $4 RegExpConstructor::Dollar4 DontDelete|ReadOnly59 $5 RegExpConstructor::Dollar5 DontDelete|ReadOnly60 $6 RegExpConstructor::Dollar6 DontDelete|ReadOnly61 $7 RegExpConstructor::Dollar7 DontDelete|ReadOnly62 $8 RegExpConstructor::Dollar8 DontDelete|ReadOnly63 $9 RegExpConstructor::Dollar9 DontDelete|ReadOnly67 input regExpConstructorInput None 68 $_ regExpConstructorInput DontEnum 69 multiline regExpConstructorMultiline None 70 $* regExpConstructorMultiline DontEnum 71 lastMatch regExpConstructorLastMatch DontDelete|ReadOnly 72 $& regExpConstructorLastMatch DontDelete|ReadOnly|DontEnum 73 lastParen regExpConstructorLastParen DontDelete|ReadOnly 74 $+ regExpConstructorLastParen DontDelete|ReadOnly|DontEnum 75 leftContext regExpConstructorLeftContext DontDelete|ReadOnly 76 $` regExpConstructorLeftContext DontDelete|ReadOnly|DontEnum 77 rightContext regExpConstructorRightContext DontDelete|ReadOnly 78 $' regExpConstructorRightContext DontDelete|ReadOnly|DontEnum 79 $1 regExpConstructorDollar1 DontDelete|ReadOnly 80 $2 regExpConstructorDollar2 DontDelete|ReadOnly 81 $3 regExpConstructorDollar3 DontDelete|ReadOnly 82 $4 regExpConstructorDollar4 DontDelete|ReadOnly 83 $5 regExpConstructorDollar5 DontDelete|ReadOnly 84 $6 regExpConstructorDollar6 DontDelete|ReadOnly 85 $7 regExpConstructorDollar7 DontDelete|ReadOnly 86 $8 regExpConstructorDollar8 DontDelete|ReadOnly 87 $9 regExpConstructorDollar9 DontDelete|ReadOnly 64 88 @end 65 89 */ … … 203 227 } 204 228 205 JSValue* RegExpConstructor::getValueProperty(ExecState* exec, int token) const 206 { 207 switch (token) { 208 case Dollar1: 209 return getBackref(exec, 1); 210 case Dollar2: 211 return getBackref(exec, 2); 212 case Dollar3: 213 return getBackref(exec, 3); 214 case Dollar4: 215 return getBackref(exec, 4); 216 case Dollar5: 217 return getBackref(exec, 5); 218 case Dollar6: 219 return getBackref(exec, 6); 220 case Dollar7: 221 return getBackref(exec, 7); 222 case Dollar8: 223 return getBackref(exec, 8); 224 case Dollar9: 225 return getBackref(exec, 9); 226 case Input: 227 return jsString(exec, d->input); 228 case Multiline: 229 return jsBoolean(d->multiline); 230 case LastMatch: 231 return getBackref(exec, 0); 232 case LastParen: 233 return getLastParen(exec); 234 case LeftContext: 235 return getLeftContext(exec); 236 case RightContext: 237 return getRightContext(exec); 238 default: 239 ASSERT_NOT_REACHED(); 240 } 241 242 return jsEmptyString(exec); 229 JSValue* regExpConstructorDollar1(ExecState* exec, const Identifier&, const PropertySlot& slot) 230 { 231 return static_cast<RegExpConstructor*>(slot.slotBase())->getBackref(exec, 1); 232 } 233 234 JSValue* regExpConstructorDollar2(ExecState* exec, const Identifier&, const PropertySlot& slot) 235 { 236 return static_cast<RegExpConstructor*>(slot.slotBase())->getBackref(exec, 2); 237 } 238 239 JSValue* regExpConstructorDollar3(ExecState* exec, const Identifier&, const PropertySlot& slot) 240 { 241 return static_cast<RegExpConstructor*>(slot.slotBase())->getBackref(exec, 3); 242 } 243 244 JSValue* regExpConstructorDollar4(ExecState* exec, const Identifier&, const PropertySlot& slot) 245 { 246 return static_cast<RegExpConstructor*>(slot.slotBase())->getBackref(exec, 4); 247 } 248 249 JSValue* regExpConstructorDollar5(ExecState* exec, const Identifier&, const PropertySlot& slot) 250 { 251 return static_cast<RegExpConstructor*>(slot.slotBase())->getBackref(exec, 5); 252 } 253 254 JSValue* regExpConstructorDollar6(ExecState* exec, const Identifier&, const PropertySlot& slot) 255 { 256 return static_cast<RegExpConstructor*>(slot.slotBase())->getBackref(exec, 6); 257 } 258 259 JSValue* regExpConstructorDollar7(ExecState* exec, const Identifier&, const PropertySlot& slot) 260 { 261 return static_cast<RegExpConstructor*>(slot.slotBase())->getBackref(exec, 7); 262 } 263 264 JSValue* regExpConstructorDollar8(ExecState* exec, const Identifier&, const PropertySlot& slot) 265 { 266 return static_cast<RegExpConstructor*>(slot.slotBase())->getBackref(exec, 8); 267 } 268 269 JSValue* regExpConstructorDollar9(ExecState* exec, const Identifier&, const PropertySlot& slot) 270 { 271 return static_cast<RegExpConstructor*>(slot.slotBase())->getBackref(exec, 9); 272 } 273 274 JSValue* regExpConstructorInput(ExecState* exec, const Identifier&, const PropertySlot& slot) 275 { 276 return jsString(exec, static_cast<RegExpConstructor*>(slot.slotBase())->input()); 277 } 278 279 JSValue* regExpConstructorMultiline(ExecState*, const Identifier&, const PropertySlot& slot) 280 { 281 return jsBoolean(static_cast<RegExpConstructor*>(slot.slotBase())->multiline()); 282 } 283 284 JSValue* regExpConstructorLastMatch(ExecState* exec, const Identifier&, const PropertySlot& slot) 285 { 286 return static_cast<RegExpConstructor*>(slot.slotBase())->getBackref(exec, 0); 287 } 288 289 JSValue* regExpConstructorLastParen(ExecState* exec, const Identifier&, const PropertySlot& slot) 290 { 291 return static_cast<RegExpConstructor*>(slot.slotBase())->getLastParen(exec); 292 } 293 294 JSValue* regExpConstructorLeftContext(ExecState* exec, const Identifier&, const PropertySlot& slot) 295 { 296 return static_cast<RegExpConstructor*>(slot.slotBase())->getLeftContext(exec); 297 } 298 299 JSValue* regExpConstructorRightContext(ExecState* exec, const Identifier&, const PropertySlot& slot) 300 { 301 return static_cast<RegExpConstructor*>(slot.slotBase())->getRightContext(exec); 243 302 } 244 303 … … 248 307 } 249 308 250 void RegExpConstructor::putValueProperty(ExecState* exec, int token, JSValue* value) 251 { 252 switch (token) { 253 case Input: 254 d->input = value->toString(exec); 255 break; 256 case Multiline: 257 d->multiline = value->toBoolean(exec); 258 break; 259 default: 260 ASSERT_NOT_REACHED(); 261 } 309 void setRegExpConstructorInput(ExecState* exec, JSObject* baseObject, JSValue* value) 310 { 311 static_cast<RegExpConstructor*>(baseObject)->setInput(value->toString(exec)); 312 } 313 314 void setRegExpConstructorMultiline(ExecState* exec, JSObject* baseObject, JSValue* value) 315 { 316 static_cast<RegExpConstructor*>(baseObject)->setMultiline(value->toBoolean(exec)); 262 317 } 263 318 … … 306 361 } 307 362 363 void RegExpConstructor::setInput(const UString& input) 364 { 365 d->input = input; 366 } 367 308 368 const UString& RegExpConstructor::input() const 309 369 { … … 313 373 } 314 374 375 void RegExpConstructor::setMultiline(bool multiline) 376 { 377 d->multiline = multiline; 378 } 379 380 bool RegExpConstructor::multiline() const 381 { 382 return d->multiline; 383 } 384 315 385 } // namespace JSC
Note:
See TracChangeset
for help on using the changeset viewer.