1 /* 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 * 18 */ 19 20 #ifndef RegExpMatchesArray_h 21 #define RegExpMatchesArray_h 22 23 #include "JSArray.h" 24 25 namespace JSC { 26 27 class RegExpMatchesArray : public JSArray { 28 public: 29 RegExpMatchesArray(ExecState*, RegExpConstructorPrivate*); 30 virtual ~RegExpMatchesArray(); 31 32 private: getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)33 virtual bool getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 34 { 35 if (lazyCreationData()) 36 fillArrayInstance(exec); 37 return JSArray::getOwnPropertySlot(exec, propertyName, slot); 38 } 39 getOwnPropertySlot(ExecState * exec,unsigned propertyName,PropertySlot & slot)40 virtual bool getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot) 41 { 42 if (lazyCreationData()) 43 fillArrayInstance(exec); 44 return JSArray::getOwnPropertySlot(exec, propertyName, slot); 45 } 46 put(ExecState * exec,const Identifier & propertyName,JSValue v,PutPropertySlot & slot)47 virtual void put(ExecState* exec, const Identifier& propertyName, JSValue v, PutPropertySlot& slot) 48 { 49 if (lazyCreationData()) 50 fillArrayInstance(exec); 51 JSArray::put(exec, propertyName, v, slot); 52 } 53 put(ExecState * exec,unsigned propertyName,JSValue v)54 virtual void put(ExecState* exec, unsigned propertyName, JSValue v) 55 { 56 if (lazyCreationData()) 57 fillArrayInstance(exec); 58 JSArray::put(exec, propertyName, v); 59 } 60 deleteProperty(ExecState * exec,const Identifier & propertyName)61 virtual bool deleteProperty(ExecState* exec, const Identifier& propertyName) 62 { 63 if (lazyCreationData()) 64 fillArrayInstance(exec); 65 return JSArray::deleteProperty(exec, propertyName); 66 } 67 deleteProperty(ExecState * exec,unsigned propertyName)68 virtual bool deleteProperty(ExecState* exec, unsigned propertyName) 69 { 70 if (lazyCreationData()) 71 fillArrayInstance(exec); 72 return JSArray::deleteProperty(exec, propertyName); 73 } 74 getPropertyNames(ExecState * exec,PropertyNameArray & arr)75 virtual void getPropertyNames(ExecState* exec, PropertyNameArray& arr) 76 { 77 if (lazyCreationData()) 78 fillArrayInstance(exec); 79 JSArray::getPropertyNames(exec, arr); 80 } 81 82 void fillArrayInstance(ExecState*); 83 }; 84 85 } 86 87 #endif // RegExpMatchesArray_h 88