| Index: src/v8natives.js
|
| diff --git a/src/v8natives.js b/src/v8natives.js
|
| index 1e42ac5d1eb2e100444303cc78e19bfe9e243525..d163f5e23218b1f8946d602b7a0e19ce0e72d12f 100644
|
| --- a/src/v8natives.js
|
| +++ b/src/v8natives.js
|
| @@ -1738,6 +1738,16 @@ SetUpNumber();
|
| // ----------------------------------------------------------------------------
|
| // Function
|
|
|
| +function NativeCodeFunctionSourceString(func) {
|
| + var name = %FunctionGetName(func);
|
| + if (name) {
|
| + // Mimic what KJS does.
|
| + return 'function ' + name + '() { [native code] }';
|
| + }
|
| +
|
| + return 'function () { [native code] }';
|
| +}
|
| +
|
| function FunctionSourceString(func) {
|
| while (%IsJSFunctionProxy(func)) {
|
| func = %GetCallTrap(func);
|
| @@ -1747,20 +1757,18 @@ function FunctionSourceString(func) {
|
| throw MakeTypeError(kNotGeneric, 'Function.prototype.toString');
|
| }
|
|
|
| + if (%FunctionIsBuiltin(func)) {
|
| + return NativeCodeFunctionSourceString(func);
|
| + }
|
| +
|
| var classSource = %ClassGetSourceCode(func);
|
| if (IS_STRING(classSource)) {
|
| return classSource;
|
| }
|
|
|
| var source = %FunctionGetSourceCode(func);
|
| - if (!IS_STRING(source) || %FunctionIsBuiltin(func)) {
|
| - var name = %FunctionGetName(func);
|
| - if (name) {
|
| - // Mimic what KJS does.
|
| - return 'function ' + name + '() { [native code] }';
|
| - } else {
|
| - return 'function () { [native code] }';
|
| - }
|
| + if (!IS_STRING(source)) {
|
| + return NativeCodeFunctionSourceString(func);
|
| }
|
|
|
| if (%FunctionIsArrow(func)) {
|
|
|