Mercurial > spidermonkey-playground
diff tcb.js @ 34:afca92a2e72e
enumeration is now supported on wrappers via JSNewEnumerateOp.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Mon, 22 Jun 2009 15:33:18 -0700 |
parents | bda50240b295 |
children | cfdbaadf21b8 |
line wrap: on
line diff
--- a/tcb.js Mon Jun 22 14:39:04 2009 -0700 +++ b/tcb.js Mon Jun 22 15:33:18 2009 -0700 @@ -149,8 +149,10 @@ return wrappee == other; }, - enumerate: function() { - throw new Error("Enumeration is not implemented."); + enumerate: function(wrappee, wrapper) { + // TODO: Is this secure? + for (name in wrappee) + yield name; }, iteratorObject: function(wrappee, wrapper, keysOnly) { @@ -205,6 +207,11 @@ print("module.foo() is " + module.foo()); })(); +for (name in module) + print(name); + +print("enumerate is " + enumerate(module)); + // Some unit tests. var wrapper = {};