Browse Source

fix duk_def_prop_index() (key and value were swapped), fix tracedata length

pull/1/head
Sami Vaarala 11 years ago
parent
commit
2f93c246cf
  1. 1
      src/duk_api_object.c
  2. 4
      src/duk_error_augment.c

1
src/duk_api_object.c

@ -243,6 +243,7 @@ void duk_def_prop_index(duk_context *ctx, int obj_index, unsigned int arr_index,
*/
obj_index = duk_require_normalize_index(ctx, obj_index);
duk_push_number(ctx, (double) arr_index); /* FIXME: push u32 */
duk_insert(ctx, -2); /* [ key value ] */
duk_def_prop(ctx, obj_index, desc_flags);
}

4
src/duk_error_augment.c

@ -120,6 +120,10 @@ static void add_traceback(duk_hthread *thr, duk_hthread *thr_callstack, duk_hobj
arr_idx++;
}
/* FIXME: set with duk_hobject_set_length() when tracedata is filled directly */
duk_push_int(ctx, (int) arr_idx);
duk_def_prop_stridx(ctx, -2, DUK_STRIDX_LENGTH, DUK_PROPDESC_FLAGS_WC);
/* [... arr] */
duk_def_prop_stridx(ctx, err_index, DUK_STRIDX_TRACEDATA, DUK_PROPDESC_FLAGS_WEC); /* -> [...] */
}

Loading…
Cancel
Save