Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Unified Diff: runtime/vm/scanner.cc

Issue 11368138: Add some support for the code-point code-unit distinction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Implemented feedback from patch set 3 Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/scanner.cc
diff --git a/runtime/vm/scanner.cc b/runtime/vm/scanner.cc
index 229dfdf36f0a9b06d37104a6ec56f31b1283bff0..c40eb1a19740bcafb39ba80ba680898f996d4be9 100644
--- a/runtime/vm/scanner.cc
+++ b/runtime/vm/scanner.cc
@@ -498,7 +498,7 @@ void Scanner::ScanEscapedCodePoint(uint32_t* code_point) {
void Scanner::ScanLiteralStringChars(bool is_raw) {
- GrowableArray<uint32_t> string_chars(64);
+ GrowableArray<uint16_t> string_chars(64);
ASSERT(IsScanningString());
// We are at the first character of a string literal piece. A string literal
@@ -534,7 +534,15 @@ void Scanner::ScanLiteralStringChars(bool is_raw) {
break;
case 'u':
case 'x': {
- ScanEscapedCodePoint(&escape_char);
+ uint32_t ch;
+ ScanEscapedCodePoint(&ch);
+ int32_t code_point = ch;
+ if (code_point > Utf16::kMaxCodeUnit) {
+ string_chars.Add(Utf16::LeadFromCodePoint(code_point));
+ escape_char = Utf16::TrailFromCodePoint(code_point);
+ } else {
+ escape_char = code_point;
+ }
break;
}
default:
« no previous file with comments | « runtime/vm/scanner.h ('k') | runtime/vm/symbols.cc » ('j') | runtime/vm/unicode.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698