Skip to content

Commit

Permalink
FIXME: placeholder for function source
Browse files Browse the repository at this point in the history
  • Loading branch information
svaarala committed Dec 5, 2016
1 parent c4d7dbd commit 0abc326
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src-input/duk_bi_function.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
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)) {
duk_push_sprintf(ctx, "function %s() { [ecmascript code] }", (const char *) func_name);
Expand Down
7 changes: 3 additions & 4 deletions src-input/duk_js_compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,8 +888,9 @@ DUK_LOCAL void duk__convert_to_func_template(duk_compiler_ctx *comp_ctx, duk_boo
}

/* _Source */
#if defined(DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY)
if (0) {
/* FIXME: implement */
#if 1 /* FIXME: defined(DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY) */
if (1) {
/* XXX: Currently function source code is not stored, as it is not
* required by the standard. Source code should not be stored by
* default (user should enable it explicitly), and the source should
Expand Down Expand Up @@ -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); }'
*/

#if 0
duk_push_string(ctx, "XXX");
duk_xdef_prop_stridx(ctx, -2, DUK_STRIDX_INT_SOURCE, DUK_PROPDESC_FLAGS_NONE);
#endif
}
#endif /* DUK_USE_NONSTD_FUNC_SOURCE_PROPERTY */

Expand Down

0 comments on commit 0abc326

Please sign in to comment.