2014-08-21 12:39:33 +00:00
|
|
|
// 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;
|
|
|
|
|
2014-12-10 14:40:54 +00:00
|
|
|
"use strict";
|
|
|
|
|
2014-12-16 15:09:46 +00:00
|
|
|
function FunctionToMethod(homeObject) {
|
|
|
|
if (!IS_SPEC_FUNCTION(this)) {
|
|
|
|
throw MakeTypeError('toMethod_non_function',
|
|
|
|
[%ToString(this), typeof this]);
|
2014-08-21 12:39:33 +00:00
|
|
|
|
2014-12-16 15:09:46 +00:00
|
|
|
}
|
2014-08-21 12:39:33 +00:00
|
|
|
|
2014-12-16 15:09:46 +00:00
|
|
|
if (!IS_SPEC_OBJECT(homeObject)) {
|
|
|
|
throw MakeTypeError('toMethod_non_object',
|
|
|
|
[%ToString(homeObject)]);
|
2014-08-21 12:39:33 +00:00
|
|
|
}
|
|
|
|
|
2014-12-16 15:09:46 +00:00
|
|
|
return %ToMethod(this, homeObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
function SetupHarmonyClasses() {
|
2014-08-21 12:39:33 +00:00
|
|
|
%CheckIsBootstrapping();
|
|
|
|
|
|
|
|
InstallFunctions($Function.prototype, DONT_ENUM, $Array(
|
|
|
|
"toMethod", FunctionToMethod
|
|
|
|
));
|
2014-12-16 15:09:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SetupHarmonyClasses();
|