Ignore:
Timestamp:
Dec 4, 2005, 3:28:56 PM (19 years ago)
Author:
andersca
Message:

2005-12-04 Anders Carlsson <[email protected]>

Reviewed by Geoffrey.

  • kjs/object.cpp: (KJS::ObjectImp::canPut): Refactor to use getPropertyAttributes.

(KJS::ObjectImp::propertyIsEnumerable):
New function which checks if a property is enumerable.

(KJS::ObjectImp::getPropertyAttributes):

  • kjs/object.h: Add getPropertyAttributes and propertyIsEnumerable.
  • kjs/object_object.cpp: (ObjectPrototypeImp::ObjectPrototypeImp): (ObjectProtoFuncImp::callAsFunction):
  • kjs/object_object.h: (KJS::ObjectProtoFuncImp::): Add propertyIsEnumerable to the Object prototype.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/object_object.cpp

    r10701 r11447  
    3939  : ObjectImp() // [[Prototype]] is Null()
    4040{
    41     putDirect(toStringPropertyName, new ObjectProtoFuncImp(exec,funcProto,ObjectProtoFuncImp::ToString,            0), DontEnum);
    42     putDirect(toLocaleStringPropertyName, new ObjectProtoFuncImp(exec,funcProto,ObjectProtoFuncImp::ToLocaleString,0), DontEnum);
    43     putDirect(valueOfPropertyName,  new ObjectProtoFuncImp(exec,funcProto,ObjectProtoFuncImp::ValueOf,             0), DontEnum);
    44     putDirect("hasOwnProperty", new ObjectProtoFuncImp(exec,funcProto,ObjectProtoFuncImp::HasOwnProperty,          1), DontEnum);
     41    putDirect(toStringPropertyName, new ObjectProtoFuncImp(exec, funcProto, ObjectProtoFuncImp::ToString,               0), DontEnum);
     42    putDirect(toLocaleStringPropertyName, new ObjectProtoFuncImp(exec, funcProto, ObjectProtoFuncImp::ToLocaleString,   0), DontEnum);
     43    putDirect(valueOfPropertyName, new ObjectProtoFuncImp(exec, funcProto, ObjectProtoFuncImp::ValueOf,                 0), DontEnum);
     44    putDirect("hasOwnProperty", new ObjectProtoFuncImp(exec, funcProto, ObjectProtoFuncImp::HasOwnProperty,             1), DontEnum);
     45    putDirect("propertyIsEnumerable", new ObjectProtoFuncImp(exec, funcProto, ObjectProtoFuncImp::PropertyIsEnumerable, 1), DontEnum);
    4546}
    4647
     
    6263}
    6364
    64 // ECMA 15.2.4.2, 15.2.4.4, 15.2.4.5
     65// ECMA 15.2.4.2, 15.2.4.4, 15.2.4.5, 15.2.4.7
    6566
    6667ValueImp *ObjectProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
     
    7374            return jsBoolean(thisObj->getOwnPropertySlot(exec, Identifier(args[0]->toString(exec)), slot));
    7475        }
     76        case PropertyIsEnumerable:
     77            return jsBoolean(thisObj->propertyIsEnumerable(exec, Identifier(args[0]->toString(exec))));
    7578        case ToLocaleString:
    7679            return jsString(thisObj->toString(exec));
Note: See TracChangeset for help on using the changeset viewer.