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

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

Issue 724373003: Make toString visible on enum classes, as required by proposed spec. (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 4450 matching lines...) Expand 10 before | Expand all | Expand 10 after
4461 enum_members.AddField(names_field); 4461 enum_members.AddField(names_field);
4462 const Array& names_array = Array::Handle(Array::MakeArray(enum_names)); 4462 const Array& names_array = Array::Handle(Array::MakeArray(enum_names));
4463 names_field.set_value(names_array); 4463 names_field.set_value(names_array);
4464 names_field.RecordStore(names_array); 4464 names_field.RecordStore(names_array);
4465 4465
4466 // Clone the toString() function from the helper class. 4466 // Clone the toString() function from the helper class.
4467 Function& to_string_func = Function::Handle(I, 4467 Function& to_string_func = Function::Handle(I,
4468 helper_class.LookupDynamicFunctionAllowPrivate(Symbols::toString())); 4468 helper_class.LookupDynamicFunctionAllowPrivate(Symbols::toString()));
4469 ASSERT(!to_string_func.IsNull()); 4469 ASSERT(!to_string_func.IsNull());
4470 to_string_func = to_string_func.Clone(cls); 4470 to_string_func = to_string_func.Clone(cls);
4471 to_string_func.set_is_visible(false);
4472 enum_members.AddFunction(to_string_func); 4471 enum_members.AddFunction(to_string_func);
4473 4472
4474 cls.AddFields(enum_members.fields()); 4473 cls.AddFields(enum_members.fields());
4475 const Array& functions = 4474 const Array& functions =
4476 Array::Handle(I, Array::MakeArray(enum_members.functions())); 4475 Array::Handle(I, Array::MakeArray(enum_members.functions()));
4477 cls.SetFunctions(functions); 4476 cls.SetFunctions(functions);
4478 } 4477 }
4479 4478
4480 4479
4481 // Add an implicit constructor to the given class. 4480 // Add an implicit constructor to the given class.
(...skipping 7656 matching lines...) Expand 10 before | Expand all | Expand 10 after
12138 void Parser::SkipQualIdent() { 12137 void Parser::SkipQualIdent() {
12139 ASSERT(IsIdentifier()); 12138 ASSERT(IsIdentifier());
12140 ConsumeToken(); 12139 ConsumeToken();
12141 if (CurrentToken() == Token::kPERIOD) { 12140 if (CurrentToken() == Token::kPERIOD) {
12142 ConsumeToken(); // Consume the kPERIOD token. 12141 ConsumeToken(); // Consume the kPERIOD token.
12143 ExpectIdentifier("identifier expected after '.'"); 12142 ExpectIdentifier("identifier expected after '.'");
12144 } 12143 }
12145 } 12144 }
12146 12145
12147 } // namespace dart 12146 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/language/enum_to_string_test.dart » ('j') | tests/language/enum_to_string_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698