Browse Source

add a feature option for non-strict function 'caller' property, add a feature option to disable Array.splice() real world behavior, document the two options

pull/2/head
Sami Vaarala 11 years ago
parent
commit
f39e60cfc1
  1. 2
      Makefile
  2. 11
      src/duk_features.h
  3. 18
      website/guide/compiling.html

2
Makefile

@ -172,6 +172,8 @@ CCOPTS_SHARED += -DDUK_OPT_DEBUG_BUFSIZE=512
#CCOPTS_SHARED += -DDUK_OPT_NO_INTERRUPT_COUNTER
#CCOPTS_SHARED += -DDUK_OPT_NO_JSONX
#CCOPTS_SHARED += -DDUK_OPT_NO_JSONC
#CCOPTS_SHARED += -DDUK_OPT_FUNC_NONSTD_CALLER_PROPERTY
#CCOPTS_SHARED += -DDUK_OPT_NO_ARRAY_SPLICE_NONSTD_DELCOUNT
#CCOPTS_SHARED += -DDUK_CMDLINE_BAREBONES
CCOPTS_NONDEBUG = $(CCOPTS_SHARED) -Os -fomit-frame-pointer
CCOPTS_NONDEBUG += -g -ggdb

11
src/duk_features.h

@ -1632,6 +1632,17 @@ typedef FILE duk_file;
* when deleteCount is omitted.
*/
#define DUK_USE_ARRAY_SPLICE_NONSTD_DELCOUNT
#if defined(DUK_OPT_NO_ARRAY_SPLICE_NONSTD_DELCOUNT)
#undef DUK_USE_ARRAY_SPLICE_NONSTD_DELCOUNT
#endif
/* Non-standard 'caller' property for function instances, see
* test-bi-function-nonstd-caller-prop.js.
*/
#undef DUK_USE_FUNC_NONSTD_CALLER_PROPERTY
#if defined(DUK_OPT_FUNC_NONSTD_CALLER_PROPERTY)
#define DUK_USE_FUNC_NONSTD_CALLER_PROPERTY
#endif
/*
* Function instance features.

18
website/guide/compiling.html

@ -176,6 +176,24 @@ The table below summarizes the available options, in no particular order:</p>
declarations ("hoist" them to function top) with V8-like semantics.</td>
</tr>
<tr>
<td class="definename">DUK_OPT_FUNC_NONSTD_CALLER_PROPERTY</td>
<td>Add a non-standard <code>caller</code> property to non-strict function
instances for better compatibility with existing code. The semantics
of this property are not standardized and may vary between engines;
Duktape tries to behave close to V8 and Spidermonkey. See
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/caller">Mozilla</a>
description of the property.</td>
</tr>
<tr>
<td class="definename">DUK_OPT_NO_ARRAY_SPLICE_NONSTD_DELCOUNT</td>
<td>For better compatibility with existing code, <code>Array.splice()</code>
has non-standard behavior by default when the second argument (deleteCount)
is not given: the splice operation is extended to the end of the array.
If this option is given, <code>Array.splice()</code> will behave in a
strictly conforming fashion, treating a missing deleteCount the same as
an undefined (or 0) value.</td>
</tr>
<tr>
<td class="definename">DUK_OPT_NO_JSONX</td>
<td>Disable support for the JSONX format. Reduces code footprint. Causes
JSONX calls to throw an error.</td>

Loading…
Cancel
Save