Chromium Code Reviews| 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 // Assert: obj is not null or undefined | |
|
arv (Not doing code reviews)
2015/01/21 15:05:18
Remove?
caitp (gmail)
2015/01/21 17:21:49
Acknowledged.
| |
| 660 var func = obj[p]; | |
| 661 if (IS_NULL_OR_UNDEFINED(func)) return; | |
|
arv (Not doing code reviews)
2015/01/21 15:05:18
return UNDEFINED;
for clarity?
caitp (gmail)
2015/01/21 17:21:49
Acknowledged.
| |
| 662 if (IS_SPEC_FUNCTION(func)) return func; | |
| 663 throw MakeTypeError('called_non_callable', [typeof func]); | |
|
arv (Not doing code reviews)
2015/01/21 15:05:18
maybe update this to use the new better error mess
caitp (gmail)
2015/01/21 17:21:49
I had a go at it, but it will end up implicating A
| |
| 664 } | |
| 665 | |
| 666 | |
| 657 // Harmony proxies. | 667 // Harmony proxies. |
| 658 function DefineProxyProperty(obj, p, attributes, should_throw) { | 668 function DefineProxyProperty(obj, p, attributes, should_throw) { |
| 659 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 669 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
| 660 if (IS_SYMBOL(p)) return false; | 670 if (IS_SYMBOL(p)) return false; |
| 661 | 671 |
| 662 var handler = %GetHandler(obj); | 672 var handler = %GetHandler(obj); |
| 663 var result = CallTrap2(handler, "defineProperty", UNDEFINED, p, attributes); | 673 var result = CallTrap2(handler, "defineProperty", UNDEFINED, p, attributes); |
| 664 if (!ToBoolean(result)) { | 674 if (!ToBoolean(result)) { |
| 665 if (should_throw) { | 675 if (should_throw) { |
| 666 throw MakeTypeError("handler_returned_false", | 676 throw MakeTypeError("handler_returned_false", |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1888 } | 1898 } |
| 1889 if (!IS_SPEC_FUNCTION(method)) { | 1899 if (!IS_SPEC_FUNCTION(method)) { |
| 1890 throw MakeTypeError('not_iterable', [obj]); | 1900 throw MakeTypeError('not_iterable', [obj]); |
| 1891 } | 1901 } |
| 1892 var iterator = %_CallFunction(obj, method); | 1902 var iterator = %_CallFunction(obj, method); |
| 1893 if (!IS_SPEC_OBJECT(iterator)) { | 1903 if (!IS_SPEC_OBJECT(iterator)) { |
| 1894 throw MakeTypeError('not_an_iterator', [iterator]); | 1904 throw MakeTypeError('not_an_iterator', [iterator]); |
| 1895 } | 1905 } |
| 1896 return iterator; | 1906 return iterator; |
| 1897 } | 1907 } |
| OLD | NEW |