Browse Source

rename _filename to fileName in function templates and closures, it's more useful

pull/1/head
Sami Vaarala 11 years ago
parent
commit
fde6832319
  1. 2
      src/duk_builtin_error.c
  2. 4
      src/duk_js_compiler.c
  3. 4
      src/duk_js_var.c
  4. 4
      src/genstrings.py

2
src/duk_builtin_error.c

@ -153,7 +153,7 @@ int duk_builtin_error_prototype_stack(duk_context *ctx) {
pc = (int) fmod(d, DUK_DOUBLE_2TO32);
flags = (int) floor(d / DUK_DOUBLE_2TO32);
duk_get_prop_stridx(ctx, -2, DUK_STRIDX_NAME);
duk_get_prop_stridx(ctx, -3, DUK_STRIDX_INT_FILENAME);
duk_get_prop_stridx(ctx, -3, DUK_STRIDX_FILE_NAME);
duk_get_prop_stridx(ctx, -4, DUK_STRIDX_INT_PC2LINE);
if (duk_is_buffer(ctx, -1)) {

4
src/duk_js_compiler.c

@ -837,14 +837,14 @@ static void convert_to_function_template(duk_compiler_ctx *comp_ctx) {
*/
}
/* _filename */
/* fileName */
if (comp_ctx->h_filename) {
/*
* Source filename (or equivalent), for identifying thrown errors.
*/
duk_push_hstring(ctx, comp_ctx->h_filename);
duk_def_prop_stridx(ctx, -2, DUK_STRIDX_INT_FILENAME, DUK_PROPDESC_FLAGS_NONE);
duk_def_prop_stridx(ctx, -2, DUK_STRIDX_FILE_NAME, DUK_PROPDESC_FLAGS_NONE);
}
/*

4
src/duk_js_var.c

@ -113,10 +113,10 @@ void duk_js_push_closure(duk_hthread *thr,
duk_hcompiledfunction *fun_clos;
duk_u16 proplist[] = { DUK_STRIDX_INT_VARMAP,
DUK_STRIDX_INT_FORMALS,
DUK_STRIDX_INT_SOURCE,
DUK_STRIDX_NAME,
DUK_STRIDX_INT_PC2LINE,
DUK_STRIDX_INT_FILENAME }; /* order: most frequent to least frequent */
DUK_STRIDX_FILE_NAME,
DUK_STRIDX_INT_SOURCE }; /* order: most frequent to least frequent */
int i;
duk_u32 len_value;

4
src/genstrings.py

@ -483,7 +483,8 @@ duk_string_list = [
mkstr("tracedata", custom=True),
# non-standard function instance properties
mkstr("name", custom=True), # function declaration/expression name (or empty)
mkstr("name", custom=True), # function declaration/expression name (or empty)
mkstr("fileName", custom=True), # filename associated with function (shown in tracebacks)
# typeof - these produce unfortunate naming conflicts like "Object" vs "object"
mkstr("buffer", custom=True),
@ -506,7 +507,6 @@ duk_string_list = [
mkstr("varenv", internal=True, custom=True),
mkstr("source", internal=True, custom=True),
mkstr("pc2line", internal=True, custom=True),
mkstr("filename", internal=True, custom=True),
# internal properties for thread objects

Loading…
Cancel
Save