Browse Source

Fix constructable/namebinding flags for compile

pull/1246/head
Sami Vaarala 8 years ago
parent
commit
bd6150baef
  1. 1
      src-input/duk_bi_function.c
  2. 13
      src-input/duk_js_compiler.c

1
src-input/duk_bi_function.c

@ -76,6 +76,7 @@ DUK_INTERNAL duk_ret_t duk_bi_function_constructor(duk_context *ctx) {
func = (duk_hcompfunc *) duk_known_hobject(ctx, -1);
DUK_ASSERT(DUK_HOBJECT_IS_COMPFUNC((duk_hobject *) func));
DUK_ASSERT(DUK_HOBJECT_HAS_CONSTRUCTABLE((duk_hobject *) func));
/* [ body formals source template ] */

13
src-input/duk_js_compiler.c

@ -7778,21 +7778,26 @@ DUK_LOCAL duk_ret_t duk__js_compile_raw(duk_context *ctx, void *udata) {
* on flags.
*/
DUK_ASSERT(func->is_setget == 0);
func->is_strict = is_strict;
func->is_setget = 0;
DUK_ASSERT(func->is_notail == 0);
if (is_funcexpr) {
func->is_function = 1;
func->is_eval = 0;
func->is_global = 0;
DUK_ASSERT(func->is_eval == 0);
DUK_ASSERT(func->is_global == 0);
func->is_namebinding = 1;
func->is_constructable = 1;
duk__advance(comp_ctx); /* init 'curr_token' */
duk__advance_expect(comp_ctx, DUK_TOK_FUNCTION);
(void) duk__parse_func_like_raw(comp_ctx, 0 /*flags*/);
} else {
func->is_function = 0;
DUK_ASSERT(func->is_function == 0);
func->is_eval = is_eval;
func->is_global = !is_eval;
DUK_ASSERT(func->is_namebinding == 0);
DUK_ASSERT(func->is_constructable == 0);
duk__parse_func_body(comp_ctx,
1, /* expect_eof */

Loading…
Cancel
Save