Browse Source

FIXME: placeholder for function source

pull/1147/head
Sami Vaarala 8 years ago
parent
commit
0abc326d7b
  1. 7
      src-input/duk_bi_function.c
  2. 7
      src-input/duk_js_compiler.c

7
src-input/duk_bi_function.c

@ -135,6 +135,13 @@ DUK_INTERNAL duk_ret_t duk_bi_function_prototype_to_string(duk_context *ctx) {
func_name = duk_to_string(ctx, -1); func_name = duk_to_string(ctx, -1);
DUK_ASSERT(func_name != NULL); DUK_ASSERT(func_name != NULL);
} }
/* Leave func_name on value stack for reachability. */
if (duk_get_prop_stridx(ctx, -2, DUK_STRIDX_INT_SOURCE)) {
/* If function has _Source, use it as is. */
return 1;
}
/* No need to duk_pop() here; save footprint. */
if (DUK_HOBJECT_IS_COMPFUNC(obj)) { if (DUK_HOBJECT_IS_COMPFUNC(obj)) {
duk_push_sprintf(ctx, "function %s() { [ecmascript code] }", (const char *) func_name); duk_push_sprintf(ctx, "function %s() { [ecmascript code] }", (const char *) func_name);

7
src-input/duk_js_compiler.c

@ -888,8 +888,9 @@ DUK_LOCAL void duk__convert_to_func_template(duk_compiler_ctx *comp_ctx, duk_boo
} }
/* _Source */ /* _Source */
#if defined(DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY) /* FIXME: implement */
if (0) { #if 1 /* FIXME: defined(DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY) */
if (1) {
/* XXX: Currently function source code is not stored, as it is not /* XXX: Currently function source code is not stored, as it is not
* required by the standard. Source code should not be stored by * required by the standard. Source code should not be stored by
* default (user should enable it explicitly), and the source should * default (user should enable it explicitly), and the source should
@ -928,10 +929,8 @@ DUK_LOCAL void duk__convert_to_func_template(duk_compiler_ctx *comp_ctx, duk_boo
* 'function a(foo,bar) { print(foo); }' * 'function a(foo,bar) { print(foo); }'
*/ */
#if 0
duk_push_string(ctx, "XXX"); duk_push_string(ctx, "XXX");
duk_xdef_prop_stridx(ctx, -2, DUK_STRIDX_INT_SOURCE, DUK_PROPDESC_FLAGS_NONE); duk_xdef_prop_stridx(ctx, -2, DUK_STRIDX_INT_SOURCE, DUK_PROPDESC_FLAGS_NONE);
#endif
} }
#endif /* DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY */ #endif /* DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY */

Loading…
Cancel
Save