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 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
8 | 8 |
9 // ---------------------------------------------------------------------------- | 9 // ---------------------------------------------------------------------------- |
10 // Imports | 10 // Imports |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 | 1676 |
1677 if (%FunctionIsArrow(func)) { | 1677 if (%FunctionIsArrow(func)) { |
1678 return source; | 1678 return source; |
1679 } | 1679 } |
1680 | 1680 |
1681 var name = %FunctionNameShouldPrintAsAnonymous(func) | 1681 var name = %FunctionNameShouldPrintAsAnonymous(func) |
1682 ? 'anonymous' | 1682 ? 'anonymous' |
1683 : %FunctionGetName(func); | 1683 : %FunctionGetName(func); |
1684 | 1684 |
1685 var isGenerator = %FunctionIsGenerator(func); | 1685 var isGenerator = %FunctionIsGenerator(func); |
| 1686 var isAsync = %FunctionIsAsync(func); |
1686 var head = %FunctionIsConciseMethod(func) | 1687 var head = %FunctionIsConciseMethod(func) |
1687 ? (isGenerator ? '*' : '') | 1688 ? (isGenerator ? '*' : '') |
1688 : (isGenerator ? 'function* ' : 'function '); | 1689 : (isGenerator ? 'function* ' : 'function '); |
1689 return head + name + source; | 1690 return (isAsync ? 'async ' : '') + head + name + source; |
1690 } | 1691 } |
1691 | 1692 |
1692 | 1693 |
1693 function FunctionToString() { | 1694 function FunctionToString() { |
1694 return FunctionSourceString(this); | 1695 return FunctionSourceString(this); |
1695 } | 1696 } |
1696 | 1697 |
1697 | 1698 |
1698 // ES5 15.3.4.5 | 1699 // ES5 15.3.4.5 |
1699 function FunctionBind(this_arg) { // Length is 1. | 1700 function FunctionBind(this_arg) { // Length is 1. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1849 %InstallToContext([ | 1850 %InstallToContext([ |
1850 "global_eval_fun", GlobalEval, | 1851 "global_eval_fun", GlobalEval, |
1851 "object_value_of", ObjectValueOf, | 1852 "object_value_of", ObjectValueOf, |
1852 "object_to_string", ObjectToString, | 1853 "object_to_string", ObjectToString, |
1853 "object_define_own_property", DefineOwnPropertyFromAPI, | 1854 "object_define_own_property", DefineOwnPropertyFromAPI, |
1854 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, | 1855 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, |
1855 "to_complete_property_descriptor", ToCompletePropertyDescriptor, | 1856 "to_complete_property_descriptor", ToCompletePropertyDescriptor, |
1856 ]); | 1857 ]); |
1857 | 1858 |
1858 }) | 1859 }) |
OLD | NEW |