| 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 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 var n = arguments.length; | 1836 var n = arguments.length; |
| 1837 var p = ''; | 1837 var p = ''; |
| 1838 if (n > 1) { | 1838 if (n > 1) { |
| 1839 p = ToString(arguments[0]); | 1839 p = ToString(arguments[0]); |
| 1840 for (var i = 1; i < n - 1; i++) { | 1840 for (var i = 1; i < n - 1; i++) { |
| 1841 p += ',' + ToString(arguments[i]); | 1841 p += ',' + ToString(arguments[i]); |
| 1842 } | 1842 } |
| 1843 // If the formal parameters string include ) - an illegal | 1843 // If the formal parameters string include ) - an illegal |
| 1844 // character - it may make the combined function expression | 1844 // character - it may make the combined function expression |
| 1845 // compile. We avoid this problem by checking for this early on. | 1845 // compile. We avoid this problem by checking for this early on. |
| 1846 if (%_CallFunction(p, ')', StringIndexOfJS) != -1) { | 1846 if (%_CallFunction(p, ')', $stringIndexOf) != -1) { |
| 1847 throw MakeSyntaxError('paren_in_arg_string', []); | 1847 throw MakeSyntaxError('paren_in_arg_string', []); |
| 1848 } | 1848 } |
| 1849 // If the formal parameters include an unbalanced block comment, the | 1849 // If the formal parameters include an unbalanced block comment, the |
| 1850 // function must be rejected. Since JavaScript does not allow nested | 1850 // function must be rejected. Since JavaScript does not allow nested |
| 1851 // comments we can include a trailing block comment to catch this. | 1851 // comments we can include a trailing block comment to catch this. |
| 1852 p += '\n\x2f**\x2f'; | 1852 p += '\n\x2f**\x2f'; |
| 1853 } | 1853 } |
| 1854 var body = (n > 0) ? ToString(arguments[n - 1]) : ''; | 1854 var body = (n > 0) ? ToString(arguments[n - 1]) : ''; |
| 1855 var head = '(' + function_token + '(' + p + ') {\n'; | 1855 var head = '(' + function_token + '(' + p + ') {\n'; |
| 1856 var src = head + body + '\n})'; | 1856 var src = head + body + '\n})'; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1894 } | 1894 } |
| 1895 if (!IS_SPEC_FUNCTION(method)) { | 1895 if (!IS_SPEC_FUNCTION(method)) { |
| 1896 throw MakeTypeError('not_iterable', [obj]); | 1896 throw MakeTypeError('not_iterable', [obj]); |
| 1897 } | 1897 } |
| 1898 var iterator = %_CallFunction(obj, method); | 1898 var iterator = %_CallFunction(obj, method); |
| 1899 if (!IS_SPEC_OBJECT(iterator)) { | 1899 if (!IS_SPEC_OBJECT(iterator)) { |
| 1900 throw MakeTypeError('not_an_iterator', [iterator]); | 1900 throw MakeTypeError('not_an_iterator', [iterator]); |
| 1901 } | 1901 } |
| 1902 return iterator; | 1902 return iterator; |
| 1903 } | 1903 } |
| OLD | NEW |