| 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 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 } | 1750 } |
| 1751 } | 1751 } |
| 1752 | 1752 |
| 1753 if (%FunctionIsArrow(func)) { | 1753 if (%FunctionIsArrow(func)) { |
| 1754 return source; | 1754 return source; |
| 1755 } | 1755 } |
| 1756 | 1756 |
| 1757 var name = %FunctionNameShouldPrintAsAnonymous(func) | 1757 var name = %FunctionNameShouldPrintAsAnonymous(func) |
| 1758 ? 'anonymous' | 1758 ? 'anonymous' |
| 1759 : %FunctionGetName(func); | 1759 : %FunctionGetName(func); |
| 1760 var head = %FunctionIsGenerator(func) ? 'function* ' : 'function '; | 1760 |
| 1761 // TODO(arv): Handle concise generator methods. |
| 1762 |
| 1763 var head = %FunctionIsConciseMethod(func) |
| 1764 ? '' |
| 1765 : %FunctionIsGenerator(func) ? 'function* ' : 'function '; |
| 1761 return head + name + source; | 1766 return head + name + source; |
| 1762 } | 1767 } |
| 1763 | 1768 |
| 1764 | 1769 |
| 1765 function FunctionToString() { | 1770 function FunctionToString() { |
| 1766 return FunctionSourceString(this); | 1771 return FunctionSourceString(this); |
| 1767 } | 1772 } |
| 1768 | 1773 |
| 1769 | 1774 |
| 1770 // ES5 15.3.4.5 | 1775 // ES5 15.3.4.5 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1901 } | 1906 } |
| 1902 if (!IS_SPEC_FUNCTION(method)) { | 1907 if (!IS_SPEC_FUNCTION(method)) { |
| 1903 throw MakeTypeError('not_iterable', [obj]); | 1908 throw MakeTypeError('not_iterable', [obj]); |
| 1904 } | 1909 } |
| 1905 var iterator = %_CallFunction(obj, method); | 1910 var iterator = %_CallFunction(obj, method); |
| 1906 if (!IS_SPEC_OBJECT(iterator)) { | 1911 if (!IS_SPEC_OBJECT(iterator)) { |
| 1907 throw MakeTypeError('not_an_iterator', [iterator]); | 1912 throw MakeTypeError('not_an_iterator', [iterator]); |
| 1908 } | 1913 } |
| 1909 return iterator; | 1914 return iterator; |
| 1910 } | 1915 } |
| OLD | NEW |