summaryrefslogtreecommitdiff
path: root/deps/v8/src/js/harmony-reflect.js
blob: dcadad522f63455a2aa3fbd2f9e7d6a1dc2a92ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2013-2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

(function(global, utils) {

'use strict';

%CheckIsBootstrapping();

// -------------------------------------------------------------------
// Imports

var GlobalReflect = global.Reflect;
var MakeTypeError;
var ReflectApply = utils.ImportNow("reflect_apply");
var ReflectConstruct = utils.ImportNow("reflect_construct");

utils.Import(function(from) {
  MakeTypeError = from.MakeTypeError;
});

// -------------------------------------------------------------------

function ReflectEnumerate(obj) {
  if (!IS_RECEIVER(obj))
    throw MakeTypeError(kCalledOnNonObject, "Reflect.enumerate")
  return (function* () { for (var x in obj) yield x })();
}

utils.InstallFunctions(GlobalReflect, DONT_ENUM, [
  "apply", ReflectApply,
  "construct", ReflectConstruct,
  "enumerate", ReflectEnumerate
]);

})