| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 "use strict"; | 7 "use strict"; |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| 11 // ---------------------------------------------------------------------------- | 11 // ---------------------------------------------------------------------------- |
| 12 // Imports | 12 // Imports |
| 13 // | 13 // |
| 14 var GlobalProxy = global.Proxy; | 14 var GlobalProxy = global.Proxy; |
| 15 var MakeTypeError; | 15 var MakeTypeError; |
| 16 | 16 |
| 17 utils.Import(function(from) { | 17 utils.Import(function(from) { |
| 18 MakeTypeError = from.MakeTypeError; | 18 MakeTypeError = from.MakeTypeError; |
| 19 }); | 19 }); |
| 20 | 20 |
| 21 //---------------------------------------------------------------------------- | 21 //---------------------------------------------------------------------------- |
| 22 | 22 |
| 23 function ProxyCreateRevocable(target, handler) { | 23 function ProxyCreateRevocable(target, handler) { |
| 24 var p = new GlobalProxy(target, handler); | 24 var p = new GlobalProxy(target, handler); |
| 25 return {proxy: p, revoke: () => %JSProxyRevoke(p)}; | 25 return {proxy: p, revoke: () => %RevokeProxy(p)}; |
| 26 } | 26 } |
| 27 | 27 |
| 28 // ------------------------------------------------------------------- | 28 // ------------------------------------------------------------------- |
| 29 // Proxy Builtins | 29 // Proxy Builtins |
| 30 | 30 |
| 31 // Implements part of ES6 9.5.11 Proxy.[[Enumerate]]: | 31 // Implements part of ES6 9.5.11 Proxy.[[Enumerate]]: |
| 32 // Call the trap, which should return an iterator, exhaust the iterator, | 32 // Call the trap, which should return an iterator, exhaust the iterator, |
| 33 // and return an array containing the values. | 33 // and return an array containing the values. |
| 34 function ProxyEnumerate(trap, handler, target) { | 34 function ProxyEnumerate(trap, handler, target) { |
| 35 // 7. Let trapResult be ? Call(trap, handler, «target»). | 35 // 7. Let trapResult be ? Call(trap, handler, «target»). |
| (...skipping 24 matching lines...) Expand all Loading... |
| 60 ]); | 60 ]); |
| 61 | 61 |
| 62 // ------------------------------------------------------------------- | 62 // ------------------------------------------------------------------- |
| 63 // Exports | 63 // Exports |
| 64 | 64 |
| 65 %InstallToContext([ | 65 %InstallToContext([ |
| 66 "proxy_enumerate", ProxyEnumerate, | 66 "proxy_enumerate", ProxyEnumerate, |
| 67 ]); | 67 ]); |
| 68 | 68 |
| 69 }) | 69 }) |
| OLD | NEW |