mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1027528 part 8 - Make Reflect.parse handle Latin1 strings. r=njn
This commit is contained in:
parent
6499dce503
commit
1332700889
7
js/src/jit-test/tests/latin1/assorted.js
Normal file
7
js/src/jit-test/tests/latin1/assorted.js
Normal file
@ -0,0 +1,7 @@
|
||||
// Reflect.parse Latin1
|
||||
var ast = Reflect.parse(toLatin1("function f() { return 3; }"));
|
||||
assertEq(ast.body[0].id.name, "f");
|
||||
|
||||
// Reflect.parse TwoByte
|
||||
var ast = Reflect.parse("function f\u1200() { return 3; }");
|
||||
assertEq(ast.body[0].id.name, "f\u1200");
|
@ -3294,11 +3294,16 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
if (!flat)
|
||||
return false;
|
||||
|
||||
AutoStableStringChars flatChars(cx, flat);
|
||||
if (!flatChars.initTwoByte(cx))
|
||||
return false;
|
||||
|
||||
CompileOptions options(cx);
|
||||
options.setFileAndLine(filename, lineno);
|
||||
options.setCanLazilyParse(false);
|
||||
Parser<FullParseHandler> parser(cx, &cx->tempLifoAlloc(), options, flat->chars(),
|
||||
flat->length(), /* foldConstants = */ false, nullptr, nullptr);
|
||||
mozilla::Range<const jschar> chars = flatChars.twoByteRange();
|
||||
Parser<FullParseHandler> parser(cx, &cx->tempLifoAlloc(), options, chars.start().get(),
|
||||
chars.length(), /* foldConstants = */ false, nullptr, nullptr);
|
||||
|
||||
serialize.setParser(&parser);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user