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

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

Issue 11369168: Fix result type checking of factory constructors of generic classes in VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | tests/language/factory1_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/compiler_stats.h" 10 #include "vm/compiler_stats.h"
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after
3010 member.type = &AbstractType::ZoneHandle( 3010 member.type = &AbstractType::ZoneHandle(
3011 ParseType(ClassFinalizer::kTryResolve)); 3011 ParseType(ClassFinalizer::kTryResolve));
3012 } 3012 }
3013 } 3013 }
3014 } 3014 }
3015 3015
3016 // Optionally parse a (possibly named) constructor name or factory. 3016 // Optionally parse a (possibly named) constructor name or factory.
3017 if (IsIdentifier() && 3017 if (IsIdentifier() &&
3018 (CurrentLiteral()->Equals(members->class_name()) || member.has_factory)) { 3018 (CurrentLiteral()->Equals(members->class_name()) || member.has_factory)) {
3019 if (member.has_factory) { 3019 if (member.has_factory) {
3020 // TODO(regis): Simplify this code once the core library is fixed.
3021 // See issue 6641.
3022 // Per specification, the name of the factory must be the name of the
3023 // immediately enclosing class.
3024
3020 // The factory name may be qualified. 3025 // The factory name may be qualified.
3021 QualIdent factory_name; 3026 QualIdent factory_name;
3022 ParseQualIdent(&factory_name); 3027 ParseQualIdent(&factory_name);
3023 member.name_pos = factory_name.ident_pos; 3028 member.name_pos = factory_name.ident_pos;
3024 member.name = factory_name.ident; // Unqualified identifier. 3029 member.name = factory_name.ident; // Unqualified identifier.
3025 // The class of the factory result type is specified by the factory name. 3030 // The class of the factory result type is specified by the factory name.
3026 LibraryPrefix& lib_prefix = LibraryPrefix::Handle(); 3031 LibraryPrefix& lib_prefix = LibraryPrefix::Handle();
3027 if (factory_name.lib_prefix != NULL) { 3032 if (factory_name.lib_prefix != NULL) {
3028 lib_prefix = factory_name.lib_prefix->raw(); 3033 lib_prefix = factory_name.lib_prefix->raw();
3029 } 3034 }
(...skipping 6939 matching lines...) Expand 10 before | Expand all | Expand 10 after
9969 void Parser::SkipQualIdent() { 9974 void Parser::SkipQualIdent() {
9970 ASSERT(IsIdentifier()); 9975 ASSERT(IsIdentifier());
9971 ConsumeToken(); 9976 ConsumeToken();
9972 if (CurrentToken() == Token::kPERIOD) { 9977 if (CurrentToken() == Token::kPERIOD) {
9973 ConsumeToken(); // Consume the kPERIOD token. 9978 ConsumeToken(); // Consume the kPERIOD token.
9974 ExpectIdentifier("identifier expected after '.'"); 9979 ExpectIdentifier("identifier expected after '.'");
9975 } 9980 }
9976 } 9981 }
9977 9982
9978 } // namespace dart 9983 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | tests/language/factory1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698