blob: ac0675862eacf581136d743163e74b3d67ea2b01 (
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
|
// Copyright 2014 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.
//
// This file relies on the fact that the following declarations have been made
// in runtime.js:
// var $Function = global.Function;
// var $Array = global.Array;
"use strict";
function FunctionToMethod(homeObject) {
if (!IS_SPEC_FUNCTION(this)) {
throw MakeTypeError('toMethod_non_function',
[%ToString(this), typeof this]);
}
if (!IS_SPEC_OBJECT(homeObject)) {
throw MakeTypeError('toMethod_non_object',
[%ToString(homeObject)]);
}
return %ToMethod(this, homeObject);
}
function SetupHarmonyClasses() {
%CheckIsBootstrapping();
InstallFunctions($Function.prototype, DONT_ENUM, $Array(
"toMethod", FunctionToMethod
));
}
SetupHarmonyClasses();
|