Chromium Code Reviews| Index: vm/parser.cc |
| =================================================================== |
| --- vm/parser.cc (revision 15861) |
| +++ vm/parser.cc (working copy) |
| @@ -1589,8 +1589,7 @@ |
| return; |
| } |
| String& ctor_name = String::Handle(super_class.Name()); |
| - String& ctor_suffix = String::Handle(Symbols::Dot()); |
| - ctor_name = String::Concat(ctor_name, ctor_suffix); |
| + ctor_name = String::Concat(ctor_name, Symbols::DotHandle()); |
| ArgumentListNode* arguments = new ArgumentListNode(supercall_pos); |
| // Implicit 'this' parameter is the first argument. |
| AstNode* implicit_argument = new LoadLocalNode(supercall_pos, receiver); |
| @@ -1630,13 +1629,15 @@ |
| const Class& super_class = Class::Handle(cls.SuperClass()); |
| ASSERT(!super_class.IsNull()); |
| String& ctor_name = String::Handle(super_class.Name()); |
| - String& ctor_suffix = String::Handle(Symbols::Dot()); |
| if (CurrentToken() == Token::kPERIOD) { |
| ConsumeToken(); |
| - ctor_suffix = String::Concat( |
| - ctor_suffix, *ExpectIdentifier("constructor name expected")); |
| + const String& ctor_suffix = String::Handle( |
|
hausner
2012/12/08 00:01:15
Looks like this could be simplified now, roughly l
siva
2012/12/08 00:13:56
Nice.
I fixed it.
On 2012/12/08 00:01:15, hausn
|
| + String::Concat(Symbols::DotHandle(), |
| + *ExpectIdentifier("constructor name expected"))); |
| + ctor_name = String::Concat(ctor_name, ctor_suffix); |
| + } else { |
| + ctor_name = String::Concat(ctor_name, Symbols::DotHandle()); |
| } |
| - ctor_name = String::Concat(ctor_name, ctor_suffix); |
| if (CurrentToken() != Token::kLPAREN) { |
| ErrorMsg("parameter list expected"); |
| } |
| @@ -1849,14 +1850,16 @@ |
| const intptr_t call_pos = TokenPos(); |
| ConsumeToken(); |
| String& ctor_name = String::Handle(cls.Name()); |
| - String& ctor_suffix = String::Handle(Symbols::Dot()); |
| if (CurrentToken() == Token::kPERIOD) { |
| ConsumeToken(); |
| - ctor_suffix = String::Concat( |
| - ctor_suffix, *ExpectIdentifier("constructor name expected")); |
| + const String& ctor_suffix = String::Handle( |
|
hausner
2012/12/08 00:01:15
ditto.
siva
2012/12/08 00:13:56
Done.
|
| + String::Concat(Symbols::DotHandle(), |
| + *ExpectIdentifier("constructor name expected"))); |
| + ctor_name = String::Concat(ctor_name, ctor_suffix); |
| + } else { |
| + ctor_name = String::Concat(ctor_name, Symbols::DotHandle()); |
| } |
| - ctor_name = String::Concat(ctor_name, ctor_suffix); |
| if (CurrentToken() != Token::kLPAREN) { |
| ErrorMsg("parameter list expected"); |
| } |
| @@ -2541,8 +2544,7 @@ |
| ConsumeToken(); // Colon. |
| ExpectToken(Token::kTHIS); |
| String& redir_name = String::ZoneHandle( |
| - String::Concat(members->class_name(), |
| - String::Handle(Symbols::Dot()))); |
| + String::Concat(members->class_name(), Symbols::DotHandle())); |
| if (CurrentToken() == Token::kPERIOD) { |
| ConsumeToken(); |
| redir_name = String::Concat(redir_name, |
| @@ -2948,14 +2950,16 @@ |
| } |
| // We must be dealing with a constructor or named constructor. |
| member.kind = RawFunction::kConstructor; |
| - String& ctor_suffix = String::ZoneHandle(Symbols::Dot()); |
| if (CurrentToken() == Token::kPERIOD) { |
| // Named constructor. |
| ConsumeToken(); |
| member.constructor_name = ExpectIdentifier("identifier expected"); |
| - ctor_suffix = String::Concat(ctor_suffix, *member.constructor_name); |
| + const String& ctor_suffix = String::Handle( |
|
hausner
2012/12/08 00:01:15
ditto
siva
2012/12/08 00:13:56
Done.
|
| + String::Concat(Symbols::DotHandle(), *member.constructor_name)); |
| + *member.name = String::Concat(*member.name, ctor_suffix); |
| + } else { |
| + *member.name = String::Concat(*member.name, Symbols::DotHandle()); |
| } |
| - *member.name = String::Concat(*member.name, ctor_suffix); |
| // Ensure that names are symbols. |
| *member.name = Symbols::New(*member.name); |
| if (member.type == NULL) { |
| @@ -3188,7 +3192,7 @@ |
| // The implicit constructor is unnamed, has no explicit parameter, |
| // and contains a supercall in the initializer list. |
| String& ctor_name = String::ZoneHandle( |
| - String::Concat(class_desc->class_name(), String::Handle(Symbols::Dot()))); |
| + String::Concat(class_desc->class_name(), Symbols::DotHandle())); |
| ctor_name = Symbols::New(ctor_name); |
| // The token position for the implicit constructor is the 'class' |
| // keyword of the constructor's class. |
| @@ -4075,10 +4079,9 @@ |
| ConsumeToken(); |
| String& lib_name = *ExpectIdentifier("library name expected"); |
| if (CurrentToken() == Token::kPERIOD) { |
| - const String& dot = String::Handle(Symbols::Dot()); |
| while (CurrentToken() == Token::kPERIOD) { |
| ConsumeToken(); |
| - lib_name = String::Concat(lib_name, dot); |
| + lib_name = String::Concat(lib_name, Symbols::DotHandle()); |
| lib_name = String::Concat(lib_name, |
| *ExpectIdentifier("malformed library name")); |
| } |
| @@ -8876,9 +8879,8 @@ |
| // for class 'A' is labeled 'A.C', and the static function implementing the |
| // unnamed constructor for class 'A' is labeled 'A.'. |
| // This convention prevents users from explicitly calling constructors. |
| - const String& period = String::Handle(Symbols::Dot()); |
| String& constructor_name = |
| - String::Handle(String::Concat(type_class_name, period)); |
| + String::Handle(String::Concat(type_class_name, Symbols::DotHandle())); |
| if (named_constructor != NULL) { |
| constructor_name = String::Concat(constructor_name, *named_constructor); |
| } |