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

Unified Diff: vm/parser.cc

Issue 8500006: Library prefix should be an identifier (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 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 | vm/scanner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/parser.cc
===================================================================
--- vm/parser.cc (revision 1717)
+++ vm/parser.cc (working copy)
@@ -3162,6 +3162,12 @@
ErrorMsg("prefix expected");
}
prefix = CurrentLiteral()->raw();
+ // Canonicalize the prefix string, this also simplifies the string.
+ prefix = String::NewSymbol(prefix);
hausner 2011/11/21 21:58:10 The scanner already makes a symbol out of a string
siva 2011/11/21 22:14:28 Done.
+ // TODO(asiva): Need to also check that prefix is not a reserved keyword.
+ if (!Scanner::IsIdent(prefix)) {
+ ErrorMsg("prefix should be an identifier");
+ }
ConsumeToken();
}
ExpectToken(Token::kRPAREN);
@@ -3186,7 +3192,6 @@
if (library_.LookupLocalObject(prefix) != Object::null()) {
ErrorMsg(token_index_, "'%s' is already defined", prefix.ToCString());
}
- prefix = String::NewSymbol(prefix);
const LibraryPrefix& library_prefix =
LibraryPrefix::Handle(LibraryPrefix::New(prefix, library));
library_.AddObject(library_prefix, prefix);
« no previous file with comments | « no previous file | vm/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698