MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add test for computed key evaluation order in class definitions

+7 -9
+1
examples/spec/class_computed_key.js
··· 46 46 test('multi computed field a', mc.a, 1); 47 47 test('multi computed field b', mc.b, 2); 48 48 test('multi computed field c', mc.c, 3); 49 + test('computed key evaluation order', JSON.stringify(order), JSON.stringify(['a', 'b', 'c'])); 49 50 50 51 class ComputedMethod { 51 52 ['say' + 'Hi']() {
+6 -9
src/ant.c
··· 7024 7024 utarray_push_back(saved_scope_stack, &js->scope); 7025 7025 utarray_push_back(saved_scope_stack, &js->this_val); 7026 7026 7027 - jsval_t res; 7028 - jsval_t *tc_args = NULL; 7029 - int tc_argc = 0; 7027 + jsval_t res; jsval_t *tc_args = NULL; 7028 + int tc_argc = 0; bool tc_iter = false; 7030 7029 7031 7030 for (;;) { 7032 7031 jsval_t target_this = peek_this(); ··· 7046 7045 int argc; 7047 7046 bool args_on_heap; 7048 7047 7049 - if (tc_args) { 7050 - args = tc_args; 7048 + if (tc_iter) { 7049 + args = tc_args ? tc_args : args_buf; 7051 7050 argc = tc_argc; 7052 - args_on_heap = (tc_argc > 0); 7053 - tc_args = NULL; 7054 - tc_argc = 0; 7051 + args_on_heap = (tc_args != NULL && tc_argc > 0); 7052 + tc_args = NULL; tc_argc = 0; tc_iter = false; 7055 7053 } else { 7056 7054 const char *caller_code = js->code; 7057 7055 jsoff_t caller_clen = js->clen; ··· 7221 7219 func_val = js->tc.func; 7222 7220 bound_args = NULL; 7223 7221 bound_argc = 0; 7224 - free(tc_args); 7225 7222 tc_args = js->tc.args; 7226 7223 js->tc.args = NULL; 7227 7224 tc_argc = js->tc.argc;