2016-10-10 03:43:44 +02:00
|
|
|
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
|
2017-04-20 03:09:25 +02:00
|
|
|
var $ = require('./$')
|
|
|
|
, has = require('./$.has')
|
|
|
|
, $export = require('./$.export')
|
|
|
|
, isObject = require('./$.is-object')
|
|
|
|
, anObject = require('./$.an-object');
|
2016-10-10 03:43:44 +02:00
|
|
|
|
|
|
|
function get(target, propertyKey/*, receiver*/){
|
|
|
|
var receiver = arguments.length < 3 ? target : arguments[2]
|
|
|
|
, desc, proto;
|
|
|
|
if(anObject(target) === receiver)return target[propertyKey];
|
2017-04-20 03:09:25 +02:00
|
|
|
if(desc = $.getDesc(target, propertyKey))return has(desc, 'value')
|
2016-10-10 03:43:44 +02:00
|
|
|
? desc.value
|
|
|
|
: desc.get !== undefined
|
|
|
|
? desc.get.call(receiver)
|
|
|
|
: undefined;
|
2017-04-20 03:09:25 +02:00
|
|
|
if(isObject(proto = $.getProto(target)))return get(proto, propertyKey, receiver);
|
2016-10-10 03:43:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$export($export.S, 'Reflect', {get: get});
|