mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:27:17 +00:00
Side effect characterization of String.fromCharCode
This allows dart2js to determine 'Primitive_stringFromCharCode' is effect free. BUG= R=floitsch@google.com Review URL: https://codereview.chromium.org/1420273011 .
This commit is contained in:
parent
c861e4d28a
commit
f7a39a6241
|
@ -1017,13 +1017,15 @@ class Primitives {
|
|||
static String stringFromCharCode(charCode) {
|
||||
if (0 <= charCode) {
|
||||
if (charCode <= 0xffff) {
|
||||
return JS('String', 'String.fromCharCode(#)', charCode);
|
||||
return JS('returns:String;effects:none;depends:none',
|
||||
'String.fromCharCode(#)', charCode);
|
||||
}
|
||||
if (charCode <= 0x10ffff) {
|
||||
var bits = charCode - 0x10000;
|
||||
var low = 0xDC00 | (bits & 0x3ff);
|
||||
var high = 0xD800 | (bits >> 10);
|
||||
return JS('String', 'String.fromCharCode(#, #)', high, low);
|
||||
return JS('returns:String;effects:none;depends:none',
|
||||
'String.fromCharCode(#, #)', high, low);
|
||||
}
|
||||
}
|
||||
throw new RangeError.range(charCode, 0, 0x10ffff);
|
||||
|
|
Loading…
Reference in a new issue