You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
911 B

2 years ago
'use strict';
var $ = require('../internals/export');
var DESCRIPTORS = require('../internals/descriptors');
var FORCED = require('../internals/object-prototype-accessors-forced');
var toObject = require('../internals/to-object');
var toPropertyKey = require('../internals/to-property-key');
var getPrototypeOf = require('../internals/object-get-prototype-of');
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
// `Object.prototype.__lookupGetter__` method
// https://tc39.es/ecma262/#sec-object.prototype.__lookupGetter__
if (DESCRIPTORS) {
$({ target: 'Object', proto: true, forced: FORCED }, {
__lookupGetter__: function __lookupGetter__(P) {
var O = toObject(this);
var key = toPropertyKey(P);
var desc;
do {
if (desc = getOwnPropertyDescriptor(O, key)) return desc.get;
} while (O = getPrototypeOf(O));
}
});
}