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

Side by Side Diff: runtime/vm/parser.cc

Issue 752123003: Support enum keys in maps in messages. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
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/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/ast_transformer.h" 9 #include "vm/ast_transformer.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 4438 matching lines...) Expand 10 before | Expand all | Expand 10 after
4449 names_field.RecordStore(names_array); 4449 names_field.RecordStore(names_array);
4450 4450
4451 // Clone the toString() function from the helper class. 4451 // Clone the toString() function from the helper class.
4452 Function& to_string_func = Function::Handle(I, 4452 Function& to_string_func = Function::Handle(I,
4453 helper_class.LookupDynamicFunctionAllowPrivate(Symbols::toString())); 4453 helper_class.LookupDynamicFunctionAllowPrivate(Symbols::toString()));
4454 ASSERT(!to_string_func.IsNull()); 4454 ASSERT(!to_string_func.IsNull());
4455 to_string_func = to_string_func.Clone(cls); 4455 to_string_func = to_string_func.Clone(cls);
4456 to_string_func.set_is_visible(false); 4456 to_string_func.set_is_visible(false);
4457 enum_members.AddFunction(to_string_func); 4457 enum_members.AddFunction(to_string_func);
4458 4458
4459 // Clone the hashCode getter function from the helper class.
4460 Function& hash_code_func = Function::Handle(I,
4461 helper_class.LookupDynamicFunctionAllowPrivate(Symbols::hashCode()));
4462 ASSERT(!hash_code_func.IsNull());
4463 hash_code_func = hash_code_func.Clone(cls);
4464 hash_code_func.set_is_visible(false);
4465 enum_members.AddFunction(hash_code_func);
4466
4459 cls.AddFields(enum_members.fields()); 4467 cls.AddFields(enum_members.fields());
4460 const Array& functions = 4468 const Array& functions =
4461 Array::Handle(I, Array::MakeArray(enum_members.functions())); 4469 Array::Handle(I, Array::MakeArray(enum_members.functions()));
4462 cls.SetFunctions(functions); 4470 cls.SetFunctions(functions);
4463 } 4471 }
4464 4472
4465 4473
4466 // Add an implicit constructor to the given class. 4474 // Add an implicit constructor to the given class.
4467 void Parser::AddImplicitConstructor(const Class& cls) { 4475 void Parser::AddImplicitConstructor(const Class& cls) {
4468 // The implicit constructor is unnamed, has no explicit parameter. 4476 // The implicit constructor is unnamed, has no explicit parameter.
(...skipping 7649 matching lines...) Expand 10 before | Expand all | Expand 10 after
12118 void Parser::SkipQualIdent() { 12126 void Parser::SkipQualIdent() {
12119 ASSERT(IsIdentifier()); 12127 ASSERT(IsIdentifier());
12120 ConsumeToken(); 12128 ConsumeToken();
12121 if (CurrentToken() == Token::kPERIOD) { 12129 if (CurrentToken() == Token::kPERIOD) {
12122 ConsumeToken(); // Consume the kPERIOD token. 12130 ConsumeToken(); // Consume the kPERIOD token.
12123 ExpectIdentifier("identifier expected after '.'"); 12131 ExpectIdentifier("identifier expected after '.'");
12124 } 12132 }
12125 } 12133 }
12126 12134
12127 } // namespace dart 12135 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698