Ignore:
Timestamp:
Aug 17, 2015, 11:56:52 AM (10 years ago)
Author:
Yusuke Suzuki
Message:

[ES6] Implement Reflect.get
https://bugs.webkit.org/show_bug.cgi?id=147925

Reviewed by Geoffrey Garen.

This patch implements Reflect.get API.
It can take the receiver object as the third argument.
When the receiver is specified and there's a getter for the given property name,
we call the getter with the receiver as the |this| value.

  • runtime/ReflectObject.cpp:

(JSC::reflectObjectGet):

  • runtime/SparseArrayValueMap.cpp:

(JSC::SparseArrayEntry::get): Deleted.

  • runtime/SparseArrayValueMap.h:
  • tests/stress/reflect-get.js: Added.

(shouldBe):
(shouldThrow):
(.get shouldThrow):
(.get var):
(get var.object.get hello):
(.get shouldBe):
(get var.object.set hello):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp

    r181411 r188532  
    143143}
    144144
    145 JSValue SparseArrayEntry::get(ExecState* exec, JSObject* array) const
    146 {
    147     JSValue value = Base::get();
    148     ASSERT(value);
    149 
    150     if (LIKELY(!value.isGetterSetter()))
    151         return value;
    152 
    153     return callGetter(exec, array, jsCast<GetterSetter*>(value));
    154 }
    155 
    156145void SparseArrayEntry::put(ExecState* exec, JSValue thisValue, SparseArrayValueMap* map, JSValue value, bool shouldThrow)
    157146{
Note: See TracChangeset for help on using the changeset viewer.