Browse Source

Merge pull request #1046 from svaarala/fix-fromcharcode-std-variant

Fix String.fromCharCode() coercion to ToUint16() when standard behavior enabled
pull/1049/head
Sami Vaarala 8 years ago
committed by GitHub
parent
commit
a5256f7e5d
  1. 5
      RELEASES.rst
  2. 2
      src-input/duk_bi_string.c

5
RELEASES.rst

@ -1934,6 +1934,11 @@ Planned
seed mixing; previous algorithm (Shamir's three-op algorithm) is still seed mixing; previous algorithm (Shamir's three-op algorithm) is still
used for low memory targets and targets without 64-bit types (GH-970) used for low memory targets and targets without 64-bit types (GH-970)
* Fix String.fromCharCode() behavior for non-BMP characters when standard
behavior is enabled (DUK_USE_NONSTD_STRING_FROMCHARCODE_32BIT disabled):
use ToUint16() + CESU-8 rather than ToUint32() + CESU-8 which produces
two codepoints for non-BMP characters (GH-1046)
* Fix incorrect evaluation order of X <op>= Y expressions when the RHS * Fix incorrect evaluation order of X <op>= Y expressions when the RHS
(Y) mutates the value of X (GH-992) (Y) mutates the value of X (GH-992)

2
src-input/duk_bi_string.c

@ -81,7 +81,7 @@ DUK_INTERNAL duk_ret_t duk_bi_string_constructor_from_char_code(duk_context *ctx
cp = (duk_ucodepoint_t) duk_to_uint32(ctx, i); cp = (duk_ucodepoint_t) duk_to_uint32(ctx, i);
DUK_BW_WRITE_ENSURE_XUTF8(thr, bw, cp); DUK_BW_WRITE_ENSURE_XUTF8(thr, bw, cp);
#else #else
cp = (duk_ucodepoint_t) duk_to_uint32(ctx, i); cp = (duk_ucodepoint_t) duk_to_uint16(ctx, i);
DUK_BW_WRITE_ENSURE_CESU8(thr, bw, cp); DUK_BW_WRITE_ENSURE_CESU8(thr, bw, cp);
#endif #endif
} }

Loading…
Cancel
Save