njs_ret_t ret;
nxt_str_t str;
njs_value_t *key, *val, ext_val;
+ njs_object_t *object;
njs_json_state_t *state;
njs_object_prop_t *prop;
nxt_lvlhsh_query_t lhq;
val = &ext_val;
} else {
+ object = state->value.data.u.object;
lhq.proto = &njs_object_hash_proto;
- ret = nxt_lvlhsh_find(&state->value.data.u.object->hash, &lhq);
- if (nxt_slow_path(ret == NXT_DECLINED)) {
- break;
+ ret = nxt_lvlhsh_find(&object->hash, &lhq);
+ if (ret == NXT_DECLINED) {
+ ret = nxt_lvlhsh_find(&object->shared_hash, &lhq);
+ if (nxt_slow_path(ret == NXT_DECLINED)) {
+ break;
+ }
}
prop = lhq.value;
}
}
- if (nxt_slow_path(all)) {
- nxt_lvlhsh_each_init(&lhe, &njs_object_hash_proto);
- hash = &object->shared_hash;
+ nxt_lvlhsh_each_init(&lhe, &njs_object_hash_proto);
+ hash = &object->shared_hash;
- for ( ;; ) {
- prop = nxt_lvlhsh_each(hash, &lhe);
+ for ( ;; ) {
+ prop = nxt_lvlhsh_each(hash, &lhe);
- if (prop == NULL) {
- break;
- }
+ if (prop == NULL) {
+ break;
+ }
- lhq.key_hash = lhe.key_hash;
- njs_string_get(&prop->name, &lhq.key);
+ lhq.key_hash = lhe.key_hash;
+ njs_string_get(&prop->name, &lhq.key);
- lhq.proto = &njs_object_hash_proto;
- ret = nxt_lvlhsh_find(&object->hash, &lhq);
+ lhq.proto = &njs_object_hash_proto;
+ ret = nxt_lvlhsh_find(&object->hash, &lhq);
- if (ret != NXT_OK) {
- ext_prop = njs_object_exist_in_proto(parent, object, &lhq);
+ if (ret != NXT_OK) {
+ ext_prop = njs_object_exist_in_proto(parent, object, &lhq);
- if (ext_prop == NULL) {
- length++;
- }
+ if (ext_prop == NULL && (prop->enumerable || all)) {
+ length++;
}
}
}
}
}
- if (nxt_slow_path(all)) {
- nxt_lvlhsh_each_init(&lhe, &njs_object_hash_proto);
- hash = &object->shared_hash;
+ nxt_lvlhsh_each_init(&lhe, &njs_object_hash_proto);
+ hash = &object->shared_hash;
- for ( ;; ) {
- prop = nxt_lvlhsh_each(hash, &lhe);
+ for ( ;; ) {
+ prop = nxt_lvlhsh_each(hash, &lhe);
- if (prop == NULL) {
- break;
- }
+ if (prop == NULL) {
+ break;
+ }
- lhq.key_hash = lhe.key_hash;
- njs_string_get(&prop->name, &lhq.key);
+ lhq.key_hash = lhe.key_hash;
+ njs_string_get(&prop->name, &lhq.key);
- lhq.proto = &njs_object_hash_proto;
- ret = nxt_lvlhsh_find(&object->hash, &lhq);
+ lhq.proto = &njs_object_hash_proto;
+ ret = nxt_lvlhsh_find(&object->hash, &lhq);
- if (ret != NXT_OK) {
- ext_prop = njs_object_exist_in_proto(parent, object, &lhq);
+ if (ret != NXT_OK) {
+ ext_prop = njs_object_exist_in_proto(parent, object, &lhq);
- if (ext_prop == NULL) {
- njs_string_copy(item++, &prop->name);
- }
+ if (ext_prop == NULL && (prop->enumerable || all)) {
+ njs_string_copy(item++, &prop->name);
}
}
}