Ignore:
Timestamp:
Sep 12, 2009, 7:44:32 PM (16 years ago)
Author:
[email protected]
Message:

[ES5] Implement Object.keys
https://bugs.webkit.org/show_bug.cgi?id=29170

Reviewed by Maciej Stachowiak.

This patch basically requires two separate steps, the first is to split getPropertyNames
into two functions -- getOwnPropertyNames and getPropertyNames, basically making them behave
in the same way as getOwnPropertySlot and getPropertySlot. In essence getOwnPropertyNames
produces the list of properties on an object excluding its prototype chain and getPropertyNames
just iterates the the object and its prototype chain calling getOwnPropertyNames at each level.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/StringObject.cpp

    r48083 r48336  
    8383}
    8484
    85 void StringObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
     85void StringObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
    8686{
    8787    int size = internalValue()->value().size();
    8888    for (int i = 0; i < size; ++i)
    8989        propertyNames.add(Identifier(exec, UString::from(i)));
    90     return JSObject::getPropertyNames(exec, propertyNames);
     90    return JSObject::getOwnPropertyNames(exec, propertyNames);
    9191}
    9292
Note: See TracChangeset for help on using the changeset viewer.