OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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() { |
5 "use strict"; | 6 "use strict"; |
6 | 7 |
7 // A more universal stringify that supports more types than JSON. | 8 // A more universal stringify that supports more types than JSON. |
8 // Used by the d8 shell to output results. | 9 // Used by the d8 shell to output results. |
9 var stringifyDepthLimit = 4; // To avoid crashing on cyclic objects | 10 var stringifyDepthLimit = 4; // To avoid crashing on cyclic objects |
10 | 11 |
11 // Hacky solution to circumvent forcing --allow-natives-syntax for d8 | 12 // Hacky solution to circumvent forcing --allow-natives-syntax for d8 |
12 function isProxy(o) { return false }; | 13 function isProxy(o) { return false }; |
13 function JSProxyGetTarget(proxy) { }; | 14 function JSProxyGetTarget(proxy) { }; |
14 function JSProxyGetHandler(proxy) { }; | 15 function JSProxyGetHandler(proxy) { }; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 83 } |
83 | 84 |
84 function StringifyProxy(proxy, depth) { | 85 function StringifyProxy(proxy, depth) { |
85 var proxy_type = typeof proxy; | 86 var proxy_type = typeof proxy; |
86 var info_object = { | 87 var info_object = { |
87 target: JSProxyGetTarget(proxy), | 88 target: JSProxyGetTarget(proxy), |
88 handler: JSProxyGetHandler(proxy) | 89 handler: JSProxyGetHandler(proxy) |
89 } | 90 } |
90 return '[' + proxy_type + ' Proxy ' + Stringify(info_object, depth-1) + ']'; | 91 return '[' + proxy_type + ' Proxy ' + Stringify(info_object, depth-1) + ']'; |
91 } | 92 } |
| 93 |
| 94 return Stringify; |
| 95 })(); |
OLD | NEW |