mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
489 B
28 lines
489 B
12 years ago
|
/*
|
||
|
* Enumeration: field deleted but still present in ancestor.
|
||
|
*/
|
||
|
|
||
|
/*===
|
||
|
bar skip
|
||
|
foo inherited
|
||
|
===*/
|
||
|
|
||
|
/* The 'delete a.foo' will delete 'foo' from the 'a' object, not
|
||
|
* the ancestor. So, 'foo' should still enumerate.
|
||
|
*/
|
||
|
|
||
|
function F() {};
|
||
|
F.prototype = { "foo": "inherited" };
|
||
|
|
||
|
var a = new F();
|
||
|
a.bar = "skip";
|
||
|
a.foo = "own"; // overlapping field
|
||
|
|
||
|
// enumeration order: "bar", "foo"
|
||
|
for (var i in a) {
|
||
|
delete a.foo; // only affects 'a', not F.prototype
|
||
|
print(i, a[i]);
|
||
|
}
|
||
|
|
||
|
|