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

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

Issue 8862002: Fix handling of unresolved upper bounds in factory declarations (issue 721). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 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
« no previous file with comments | « no previous file | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 qualifier ^= member.name->raw(); 2339 qualifier ^= member.name->raw();
2340 member.name = ExpectIdentifier("identifier expected"); 2340 member.name = ExpectIdentifier("identifier expected");
2341 } 2341 }
2342 } 2342 }
2343 const UnresolvedClass& unresolved_factory_class = 2343 const UnresolvedClass& unresolved_factory_class =
2344 UnresolvedClass::Handle(UnresolvedClass::New(member.name_pos, 2344 UnresolvedClass::Handle(UnresolvedClass::New(member.name_pos,
2345 qualifier, 2345 qualifier,
2346 *(member.name))); 2346 *(member.name)));
2347 const Class& signature_class = Class::Handle( 2347 const Class& signature_class = Class::Handle(
2348 Class::New(String::Handle(String::NewSymbol(":factory_signature")), 2348 Class::New(String::Handle(String::NewSymbol(":factory_signature")),
2349 Script::Handle())); 2349 script_));
2350 signature_class.set_is_finalized(); 2350 signature_class.set_is_finalized();
2351 signature_class.set_library(library_);
2351 unresolved_factory_class.set_factory_signature_class(signature_class); 2352 unresolved_factory_class.set_factory_signature_class(signature_class);
2352 // The type arguments of the result type are set during finalization. 2353 // The type arguments of the result type are set during finalization.
2353 const TypeArguments& args = TypeArguments::Handle(); 2354 const TypeArguments& args = TypeArguments::Handle();
2354 member.type = &Type::ZoneHandle( 2355 member.type = &Type::ZoneHandle(
2355 Type::NewParameterizedType(unresolved_factory_class, args)); 2356 Type::NewParameterizedType(unresolved_factory_class, args));
2356 ParseTypeParameters(signature_class); 2357 ParseTypeParameters(signature_class);
2357 } 2358 }
2358 // We must be dealing with a constructor or named constructor. 2359 // We must be dealing with a constructor or named constructor.
2359 member.kind = RawFunction::kConstructor; 2360 member.kind = RawFunction::kConstructor;
2360 String& ctor_suffix = String::ZoneHandle(String::NewSymbol(".")); 2361 String& ctor_suffix = String::ZoneHandle(String::NewSymbol("."));
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 factory_name.ident->ToCString()); 2756 factory_name.ident->ToCString());
2756 } 2757 }
2757 String& qualifier = String::Handle(); 2758 String& qualifier = String::Handle();
2758 if (factory_name.qualifier != NULL) { 2759 if (factory_name.qualifier != NULL) {
2759 qualifier ^= factory_name.qualifier->raw(); 2760 qualifier ^= factory_name.qualifier->raw();
2760 } 2761 }
2761 const UnresolvedClass& unresolved_factory_class = UnresolvedClass::Handle( 2762 const UnresolvedClass& unresolved_factory_class = UnresolvedClass::Handle(
2762 UnresolvedClass::New(factory_pos, qualifier, *(factory_name.ident))); 2763 UnresolvedClass::New(factory_pos, qualifier, *(factory_name.ident)));
2763 const Class& signature_class = Class::Handle( 2764 const Class& signature_class = Class::Handle(
2764 Class::New(String::Handle(String::NewSymbol(":factory_signature")), 2765 Class::New(String::Handle(String::NewSymbol(":factory_signature")),
2765 Script::Handle())); 2766 script_));
2767 signature_class.set_library(library_);
2766 signature_class.set_is_finalized(); 2768 signature_class.set_is_finalized();
2767 ParseTypeParameters(signature_class); 2769 ParseTypeParameters(signature_class);
2768 unresolved_factory_class.set_factory_signature_class(signature_class); 2770 unresolved_factory_class.set_factory_signature_class(signature_class);
2769 interface.set_factory_class(unresolved_factory_class); 2771 interface.set_factory_class(unresolved_factory_class);
2770 } 2772 }
2771 2773
2772 ExpectToken(Token::kLBRACE); 2774 ExpectToken(Token::kLBRACE);
2773 ClassDesc members(interface, interface_name, true, interface_pos); 2775 ClassDesc members(interface, interface_name, true, interface_pos);
2774 while (CurrentToken() != Token::kRBRACE) { 2776 while (CurrentToken() != Token::kRBRACE) {
2775 ParseClassMemberDefinition(&members); 2777 ParseClassMemberDefinition(&members);
(...skipping 4842 matching lines...) Expand 10 before | Expand all | Expand 10 after
7618 } 7620 }
7619 7621
7620 7622
7621 void Parser::SkipNestedExpr() { 7623 void Parser::SkipNestedExpr() {
7622 const bool saved_mode = SetAllowFunctionLiterals(true); 7624 const bool saved_mode = SetAllowFunctionLiterals(true);
7623 SkipExpr(); 7625 SkipExpr();
7624 SetAllowFunctionLiterals(saved_mode); 7626 SetAllowFunctionLiterals(saved_mode);
7625 } 7627 }
7626 7628
7627 } // namespace dart 7629 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698