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 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 } | 1760 } |
1761 } | 1761 } |
1762 | 1762 |
1763 if (%FunctionIsArrow(func)) { | 1763 if (%FunctionIsArrow(func)) { |
1764 return source; | 1764 return source; |
1765 } | 1765 } |
1766 | 1766 |
1767 var name = %FunctionNameShouldPrintAsAnonymous(func) | 1767 var name = %FunctionNameShouldPrintAsAnonymous(func) |
1768 ? 'anonymous' | 1768 ? 'anonymous' |
1769 : %FunctionGetName(func); | 1769 : %FunctionGetName(func); |
1770 var head = %FunctionIsGenerator(func) ? 'function* ' : 'function '; | 1770 |
| 1771 var head = %FunctionIsConciseMethod(func) |
| 1772 ? '' |
| 1773 : %FunctionIsGenerator(func) ? 'function* ' : 'function '; |
1771 return head + name + source; | 1774 return head + name + source; |
1772 } | 1775 } |
1773 | 1776 |
1774 | 1777 |
1775 function FunctionToString() { | 1778 function FunctionToString() { |
1776 return FunctionSourceString(this); | 1779 return FunctionSourceString(this); |
1777 } | 1780 } |
1778 | 1781 |
1779 | 1782 |
1780 // ES5 15.3.4.5 | 1783 // ES5 15.3.4.5 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 } | 1914 } |
1912 if (!IS_SPEC_FUNCTION(method)) { | 1915 if (!IS_SPEC_FUNCTION(method)) { |
1913 throw MakeTypeError('not_iterable', [obj]); | 1916 throw MakeTypeError('not_iterable', [obj]); |
1914 } | 1917 } |
1915 var iterator = %_CallFunction(obj, method); | 1918 var iterator = %_CallFunction(obj, method); |
1916 if (!IS_SPEC_OBJECT(iterator)) { | 1919 if (!IS_SPEC_OBJECT(iterator)) { |
1917 throw MakeTypeError('not_an_iterator', [iterator]); | 1920 throw MakeTypeError('not_an_iterator', [iterator]); |
1918 } | 1921 } |
1919 return iterator; | 1922 return iterator; |
1920 } | 1923 } |
OLD | NEW |