OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file relies on the fact that the following declarations have been made | 5 // This file relies on the fact that the following declarations have been made |
6 // in runtime.js: | 6 // in runtime.js: |
7 // var $Object = global.Object; | 7 // var $Object = global.Object; |
8 // var $Boolean = global.Boolean; | 8 // var $Boolean = global.Boolean; |
9 // var $Number = global.Number; | 9 // var $Number = global.Number; |
10 // var $Function = global.Function; | 10 // var $Function = global.Function; |
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1726 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) { | 1726 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) { |
1727 var name = %FunctionGetName(func); | 1727 var name = %FunctionGetName(func); |
1728 if (name) { | 1728 if (name) { |
1729 // Mimic what KJS does. | 1729 // Mimic what KJS does. |
1730 return 'function ' + name + '() { [native code] }'; | 1730 return 'function ' + name + '() { [native code] }'; |
1731 } else { | 1731 } else { |
1732 return 'function () { [native code] }'; | 1732 return 'function () { [native code] }'; |
1733 } | 1733 } |
1734 } | 1734 } |
1735 | 1735 |
1736 if (%FunctionIsArrow(func)) | |
1737 return source; | |
rossberg
2014/07/14 13:55:46
Nit: please use same brace style as surrounding co
| |
1738 | |
1736 var name = %FunctionNameShouldPrintAsAnonymous(func) | 1739 var name = %FunctionNameShouldPrintAsAnonymous(func) |
1737 ? 'anonymous' | 1740 ? 'anonymous' |
1738 : %FunctionGetName(func); | 1741 : %FunctionGetName(func); |
1739 var head = %FunctionIsGenerator(func) ? 'function* ' : 'function '; | 1742 var head = %FunctionIsGenerator(func) ? 'function* ' : 'function '; |
1740 return head + name + source; | 1743 return head + name + source; |
1741 } | 1744 } |
1742 | 1745 |
1743 | 1746 |
1744 function FunctionToString() { | 1747 function FunctionToString() { |
1745 return FunctionSourceString(this); | 1748 return FunctionSourceString(this); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1850 %SetCode($Function, FunctionConstructor); | 1853 %SetCode($Function, FunctionConstructor); |
1851 %AddProperty($Function.prototype, "constructor", $Function, DONT_ENUM); | 1854 %AddProperty($Function.prototype, "constructor", $Function, DONT_ENUM); |
1852 | 1855 |
1853 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1856 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1854 "bind", FunctionBind, | 1857 "bind", FunctionBind, |
1855 "toString", FunctionToString | 1858 "toString", FunctionToString |
1856 )); | 1859 )); |
1857 } | 1860 } |
1858 | 1861 |
1859 SetUpFunction(); | 1862 SetUpFunction(); |
OLD | NEW |