Browse Source

Fix compile error for DUK_OPT_NO_PC2LINE

The resulting code produces some function/variable unused warnings, but this
is OK for special options.
weak-references
Sami Vaarala 10 years ago
parent
commit
0772512892
  1. 4
      src/duk_bi_duktape.c
  2. 2
      src/duk_js_compiler.c

4
src/duk_bi_duktape.c

@ -146,7 +146,11 @@ DUK_INTERNAL duk_ret_t duk_bi_duktape_object_act(duk_context *ctx) {
pc = (duk_uint_fast32_t) act->pc; pc = (duk_uint_fast32_t) act->pc;
duk_push_uint(ctx, (duk_uint_t) pc); duk_push_uint(ctx, (duk_uint_t) pc);
#if defined(DUK_USE_PC2LINE)
line = duk_hobject_pc2line_query(ctx, -2, pc); line = duk_hobject_pc2line_query(ctx, -2, pc);
#else
line = 0;
#endif
duk_push_uint(ctx, (duk_uint_t) line); duk_push_uint(ctx, (duk_uint_t) line);
/* Providing access to e.g. act->lex_env would be dangerous: these /* Providing access to e.g. act->lex_env would be dangerous: these

2
src/duk_js_compiler.c

@ -1033,7 +1033,7 @@ DUK_LOCAL void duk__emit(duk_compiler_ctx *comp_ctx, duk_instr_t ins) {
#endif #endif
/* Limit checks for bytecode byte size and line number. */ /* Limit checks for bytecode byte size and line number. */
#if defined(DUK_USE_ESBC_LIMITS) #if defined(DUK_USE_PC2LINE) && defined(DUK_USE_ESBC_LIMITS)
if (DUK_UNLIKELY(line > DUK_USE_ESBC_MAX_LINENUMBER || if (DUK_UNLIKELY(line > DUK_USE_ESBC_MAX_LINENUMBER ||
DUK_HBUFFER_GET_SIZE((duk_hbuffer *) h) > DUK_USE_ESBC_MAX_BYTES)) { DUK_HBUFFER_GET_SIZE((duk_hbuffer *) h) > DUK_USE_ESBC_MAX_BYTES)) {
DUK_ERROR(comp_ctx->thr, DUK_ERR_RANGE_ERROR, DUK_STR_BYTECODE_LIMIT); DUK_ERROR(comp_ctx->thr, DUK_ERR_RANGE_ERROR, DUK_STR_BYTECODE_LIMIT);

Loading…
Cancel
Save