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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 %DeleteProperty(obj, p, 0); | 647 %DeleteProperty(obj, p, 0); |
648 return true; | 648 return true; |
649 } else if (should_throw) { | 649 } else if (should_throw) { |
650 throw MakeTypeError("define_disallowed", [p]); | 650 throw MakeTypeError("define_disallowed", [p]); |
651 } else { | 651 } else { |
652 return; | 652 return; |
653 } | 653 } |
654 } | 654 } |
655 | 655 |
656 | 656 |
| 657 // ES6, draft 12-24-14, section 7.3.8 |
| 658 function GetMethod(obj, p) { |
| 659 var func = obj[p]; |
| 660 if (IS_NULL_OR_UNDEFINED(func)) return UNDEFINED; |
| 661 if (IS_SPEC_FUNCTION(func)) return func; |
| 662 throw MakeTypeError('called_non_callable', [typeof func]); |
| 663 } |
| 664 |
| 665 |
657 // Harmony proxies. | 666 // Harmony proxies. |
658 function DefineProxyProperty(obj, p, attributes, should_throw) { | 667 function DefineProxyProperty(obj, p, attributes, should_throw) { |
659 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 668 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
660 if (IS_SYMBOL(p)) return false; | 669 if (IS_SYMBOL(p)) return false; |
661 | 670 |
662 var handler = %GetHandler(obj); | 671 var handler = %GetHandler(obj); |
663 var result = CallTrap2(handler, "defineProperty", UNDEFINED, p, attributes); | 672 var result = CallTrap2(handler, "defineProperty", UNDEFINED, p, attributes); |
664 if (!ToBoolean(result)) { | 673 if (!ToBoolean(result)) { |
665 if (should_throw) { | 674 if (should_throw) { |
666 throw MakeTypeError("handler_returned_false", | 675 throw MakeTypeError("handler_returned_false", |
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1888 } | 1897 } |
1889 if (!IS_SPEC_FUNCTION(method)) { | 1898 if (!IS_SPEC_FUNCTION(method)) { |
1890 throw MakeTypeError('not_iterable', [obj]); | 1899 throw MakeTypeError('not_iterable', [obj]); |
1891 } | 1900 } |
1892 var iterator = %_CallFunction(obj, method); | 1901 var iterator = %_CallFunction(obj, method); |
1893 if (!IS_SPEC_OBJECT(iterator)) { | 1902 if (!IS_SPEC_OBJECT(iterator)) { |
1894 throw MakeTypeError('not_an_iterator', [iterator]); | 1903 throw MakeTypeError('not_an_iterator', [iterator]); |
1895 } | 1904 } |
1896 return iterator; | 1905 return iterator; |
1897 } | 1906 } |
OLD | NEW |