Chromium Code Reviews| Index: runtime/vm/scanner.cc |
| =================================================================== |
| --- runtime/vm/scanner.cc (revision 26056) |
| +++ runtime/vm/scanner.cc (working copy) |
| @@ -581,7 +581,20 @@ |
| string_chars.Add(string_delimiter_); |
| } |
| } else { |
| - string_chars.Add(c0_); |
| + // Test for a two part utf16 sequence, and decode to a code point |
| + // if we find one. |
| + int32_t ch1 = c0_; |
| + if (Utf16::IsLeadSurrogate(ch1)) { |
| + ReadChar(); |
| + const int32_t ch2 = c0_; |
| + if (Utf16::IsTrailSurrogate(ch2)) { |
| + ch1 = Utf16::Decode(ch1, ch2); |
| + } else { |
| + string_chars.Add(ch1); |
| + continue; |
|
Ivan Posva
2013/08/14 05:21:52
Can you restructure this to avoid the continue?
zra
2013/08/14 14:59:11
Yes. Missed the LookaheadChar function before.
|
| + } |
| + } |
| + string_chars.Add(ch1); |
| } |
| ReadChar(); |
| } |