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); |