next->index = -1;
}
- prop = nxt_lvlhsh_each(&object->data.u.object->hash, &next->lhe);
+ for ( ;; ) {
+ prop = nxt_lvlhsh_each(&object->data.u.object->hash, &next->lhe);
+
+ if (prop == NULL) {
+ break;
+ }
- if (prop != NULL) {
- *retval = prop->name;
+ if (prop->enumerable) {
+ *retval = prop->name;
- return code->offset;
+ return code->offset;
+ }
}
nxt_mem_cache_free(vm->mem_cache_pool, next);
{ nxt_string("for (null in undefined);"),
nxt_string("ReferenceError: Invalid left-hand side \"null\" in for-in statement in 1") },
+ { nxt_string("var s = ''; for (var p in [1,2]) {s += p}; s"),
+ nxt_string("01") },
+
+ { nxt_string("var s = ''; for (var p in {a:1, b:2}) {s += p}; s"),
+ nxt_string("ab") },
+
+ { nxt_string("var s = '';"
+ "var o = Object.defineProperty({}, 'x', {value:1});"
+ "Object.defineProperty(o, 'y', {value:2, enumerable:true});"
+ "for (var p in o) {s += p}; s"),
+ nxt_string("y") },
+
/* switch. */
{ nxt_string("switch"),