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

Unified Diff: runtime/vm/scanner.cc

Issue 11366058: - Prepopulate the keyword symbol table otherwise we can end up (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scanner.cc
===================================================================
--- runtime/vm/scanner.cc (revision 14446)
+++ runtime/vm/scanner.cc (working copy)
@@ -24,6 +24,12 @@
object_store->InitKeywordTable();
hausner 2012/11/02 16:35:18 Looking at this code now I see that ObjectStore::I
keyword_symbol_table_ = object_store->keyword_symbols();
ASSERT(!keyword_symbol_table_.IsNull());
+ String& symbol = String::Handle();
+ for (int i = 0; i < Token::numKeywords; i++) {
+ Token::Kind token = static_cast<Token::Kind>(Token::kFirstKeyword + i);
+ symbol = Symbols::New(Token::Str(token));
+ keyword_symbol_table_.SetAt(i, symbol);
+ }
}
for (int i = 0; i < Token::numKeywords; i++) {
Token::Kind token = static_cast<Token::Kind>(Token::kFirstKeyword + i);
@@ -276,10 +282,7 @@
if (keywords_[i].keyword_symbol == NULL) {
String& symbol = String::ZoneHandle();
symbol ^= keyword_symbol_table_.At(i);
- if (symbol.IsNull()) {
- symbol = Symbols::New(source_, ident_pos, ident_length);
- keyword_symbol_table_.SetAt(i, symbol);
- }
+ ASSERT(!symbol.IsNull());
keywords_[i].keyword_symbol = &symbol;
}
current_token_.literal = keywords_[i].keyword_symbol;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698