| 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 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) { | 1741 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) { |
| 1742 var name = %FunctionGetName(func); | 1742 var name = %FunctionGetName(func); |
| 1743 if (name) { | 1743 if (name) { |
| 1744 // Mimic what KJS does. | 1744 // Mimic what KJS does. |
| 1745 return 'function ' + name + '() { [native code] }'; | 1745 return 'function ' + name + '() { [native code] }'; |
| 1746 } else { | 1746 } else { |
| 1747 return 'function () { [native code] }'; | 1747 return 'function () { [native code] }'; |
| 1748 } | 1748 } |
| 1749 } | 1749 } |
| 1750 | 1750 |
| 1751 if (%FunctionIsArrow(func)) { |
| 1752 return source; |
| 1753 } |
| 1754 |
| 1751 var name = %FunctionNameShouldPrintAsAnonymous(func) | 1755 var name = %FunctionNameShouldPrintAsAnonymous(func) |
| 1752 ? 'anonymous' | 1756 ? 'anonymous' |
| 1753 : %FunctionGetName(func); | 1757 : %FunctionGetName(func); |
| 1754 var head = %FunctionIsGenerator(func) ? 'function* ' : 'function '; | 1758 var head = %FunctionIsGenerator(func) ? 'function* ' : 'function '; |
| 1755 return head + name + source; | 1759 return head + name + source; |
| 1756 } | 1760 } |
| 1757 | 1761 |
| 1758 | 1762 |
| 1759 function FunctionToString() { | 1763 function FunctionToString() { |
| 1760 return FunctionSourceString(this); | 1764 return FunctionSourceString(this); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1865 %SetCode($Function, FunctionConstructor); | 1869 %SetCode($Function, FunctionConstructor); |
| 1866 %AddNamedProperty($Function.prototype, "constructor", $Function, DONT_ENUM); | 1870 %AddNamedProperty($Function.prototype, "constructor", $Function, DONT_ENUM); |
| 1867 | 1871 |
| 1868 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1872 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
| 1869 "bind", FunctionBind, | 1873 "bind", FunctionBind, |
| 1870 "toString", FunctionToString | 1874 "toString", FunctionToString |
| 1871 )); | 1875 )); |
| 1872 } | 1876 } |
| 1873 | 1877 |
| 1874 SetUpFunction(); | 1878 SetUpFunction(); |
| OLD | NEW |