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

Side by Side Diff: vm/scanner.cc

Issue 11411341: Fix for issue 7089 (Symbols::New was not quite working correctly (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/raw_object_snapshot.cc ('k') | vm/symbols.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/scanner.h" 5 #include "vm/scanner.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 } 576 }
577 escape_char = c0_; 577 escape_char = c0_;
578 break; 578 break;
579 } 579 }
580 string_chars.Add(escape_char); 580 string_chars.Add(escape_char);
581 } else if (c0_ == '$' && !is_raw) { 581 } else if (c0_ == '$' && !is_raw) {
582 // Scanned a string piece. 582 // Scanned a string piece.
583 ASSERT(string_chars.data() != NULL); 583 ASSERT(string_chars.data() != NULL);
584 // Strings are canonicalized: Allocate a symbol. 584 // Strings are canonicalized: Allocate a symbol.
585 current_token_.literal = &String::ZoneHandle( 585 current_token_.literal = &String::ZoneHandle(
586 Symbols::New(string_chars.data(), string_chars.length())); 586 Symbols::FromUTF32(string_chars.data(), string_chars.length()));
587 // Preserve error tokens. 587 // Preserve error tokens.
588 if (current_token_.kind != Token::kERROR) { 588 if (current_token_.kind != Token::kERROR) {
589 current_token_.kind = Token::kSTRING; 589 current_token_.kind = Token::kSTRING;
590 } 590 }
591 return; 591 return;
592 } else if (c0_ == string_delimiter_) { 592 } else if (c0_ == string_delimiter_) {
593 // Check if we are at the end of the string literal. 593 // Check if we are at the end of the string literal.
594 if (!string_is_multiline_ || 594 if (!string_is_multiline_ ||
595 ((LookaheadChar(1) == string_delimiter_) && 595 ((LookaheadChar(1) == string_delimiter_) &&
596 (LookaheadChar(2) == string_delimiter_))) { 596 (LookaheadChar(2) == string_delimiter_))) {
597 if (string_is_multiline_) { 597 if (string_is_multiline_) {
598 ReadChar(); // Skip two string delimiters. 598 ReadChar(); // Skip two string delimiters.
599 ReadChar(); 599 ReadChar();
600 } 600 }
601 // Preserve error tokens. 601 // Preserve error tokens.
602 if (current_token_.kind == Token::kERROR) { 602 if (current_token_.kind == Token::kERROR) {
603 ReadChar(); 603 ReadChar();
604 } else { 604 } else {
605 Recognize(Token::kSTRING); 605 Recognize(Token::kSTRING);
606 ASSERT(string_chars.data() != NULL); 606 ASSERT(string_chars.data() != NULL);
607 // Strings are canonicalized: Allocate a symbol. 607 // Strings are canonicalized: Allocate a symbol.
608 current_token_.literal = &String::ZoneHandle( 608 current_token_.literal = &String::ZoneHandle(
609 Symbols::New(string_chars.data(), string_chars.length())); 609 Symbols::FromUTF32(string_chars.data(), string_chars.length()));
610 } 610 }
611 EndStringLiteral(); 611 EndStringLiteral();
612 return; 612 return;
613 } else { 613 } else {
614 string_chars.Add(string_delimiter_); 614 string_chars.Add(string_delimiter_);
615 } 615 }
616 } else { 616 } else {
617 string_chars.Add(c0_); 617 string_chars.Add(c0_);
618 } 618 }
619 ReadChar(); 619 ReadChar();
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 "%c%#"Px"", kPrivateKeySeparator, key_value); 986 "%c%#"Px"", kPrivateKeySeparator, key_value);
987 const String& result = String::Handle(String::New(private_key, Heap::kOld)); 987 const String& result = String::Handle(String::New(private_key, Heap::kOld));
988 return result.raw(); 988 return result.raw();
989 } 989 }
990 990
991 991
992 void Scanner::InitOnce() { 992 void Scanner::InitOnce() {
993 } 993 }
994 994
995 } // namespace dart 995 } // namespace dart
OLDNEW
« no previous file with comments | « vm/raw_object_snapshot.cc ('k') | vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698