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 212883009: Handle creating ParameterMirrors for the parameters of forwarding constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: test more levels of forwarding Created 6 years, 9 months 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/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 receiver->set_invisible(false); 2450 receiver->set_invisible(false);
2451 2451
2452 // If the class of this implicit constructor is a mixin application alias, 2452 // If the class of this implicit constructor is a mixin application alias,
2453 // it is a forwarding constructor of the aliased mixin application class. 2453 // it is a forwarding constructor of the aliased mixin application class.
2454 // If the class of this implicit constructor is a mixin application class, 2454 // If the class of this implicit constructor is a mixin application class,
2455 // it is a forwarding constructor of the mixin. The forwarding 2455 // it is a forwarding constructor of the mixin. The forwarding
2456 // constructor initializes the instance fields that have initializer 2456 // constructor initializes the instance fields that have initializer
2457 // expressions and then calls the respective super constructor with 2457 // expressions and then calls the respective super constructor with
2458 // the same name and number of parameters. 2458 // the same name and number of parameters.
2459 ArgumentListNode* forwarding_args = NULL; 2459 ArgumentListNode* forwarding_args = NULL;
2460 if (current_class().is_mixin_app_alias() || 2460 if (current_class().IsMixinApplication()) {
2461 current_class().IsMixinApplication()) {
2462 // At this point we don't support forwarding constructors 2461 // At this point we don't support forwarding constructors
2463 // that have optional parameters because we don't know the default 2462 // that have optional parameters because we don't know the default
2464 // values of the optional parameters. We would have to compile the super 2463 // values of the optional parameters. We would have to compile the super
2465 // constructor to get the default values. Also, the spec is not clear 2464 // constructor to get the default values. Also, the spec is not clear
2466 // whether optional parameters are even allowed in this situation. 2465 // whether optional parameters are even allowed in this situation.
2467 // TODO(hausner): Remove this limitation if the language spec indeed 2466 // TODO(hausner): Remove this limitation if the language spec indeed
2468 // allows optional parameters. 2467 // allows optional parameters.
2469 if (func.HasOptionalParameters()) { 2468 if (func.HasOptionalParameters()) {
2470 ErrorMsg(ctor_pos, 2469 ErrorMsg(ctor_pos,
2471 "forwarding constructors must not have optional parameters"); 2470 "forwarding constructors must not have optional parameters");
(...skipping 6550 matching lines...) Expand 10 before | Expand all | Expand 10 after
9022 if (node != NULL) { 9021 if (node != NULL) {
9023 *node = new LoadLocalNode(ident_pos, local); 9022 *node = new LoadLocalNode(ident_pos, local);
9024 } 9023 }
9025 return true; 9024 return true;
9026 } 9025 }
9027 9026
9028 // Try to find the identifier in the class scope of the current class. 9027 // Try to find the identifier in the class scope of the current class.
9029 // If the current class is the result of a mixin application, we must 9028 // If the current class is the result of a mixin application, we must
9030 // use the class scope of the class from which the function originates. 9029 // use the class scope of the class from which the function originates.
9031 Class& cls = Class::Handle(isolate()); 9030 Class& cls = Class::Handle(isolate());
9032 if (!current_class().IsMixinApplication()) { 9031 if (!current_class().IsAnonymousMixinApplication()) {
hausner 2014/03/27 17:10:27 I think this is wrong. The scoping is the same whe
regis 2014/03/27 18:23:58 I think the change is correct. If the current clas
9033 cls = current_class().raw(); 9032 cls = current_class().raw();
9034 } else { 9033 } else {
9035 cls = parsed_function()->function().origin(); 9034 cls = parsed_function()->function().origin();
9036 } 9035 }
9037 Function& func = Function::Handle(isolate(), Function::null()); 9036 Function& func = Function::Handle(isolate(), Function::null());
9038 Field& field = Field::Handle(isolate(), Field::null()); 9037 Field& field = Field::Handle(isolate(), Field::null());
9039 9038
9040 // First check if a field exists. 9039 // First check if a field exists.
9041 field = cls.LookupField(ident); 9040 field = cls.LookupField(ident);
9042 if (!field.IsNull()) { 9041 if (!field.IsNull()) {
(...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after
10793 void Parser::SkipQualIdent() { 10792 void Parser::SkipQualIdent() {
10794 ASSERT(IsIdentifier()); 10793 ASSERT(IsIdentifier());
10795 ConsumeToken(); 10794 ConsumeToken();
10796 if (CurrentToken() == Token::kPERIOD) { 10795 if (CurrentToken() == Token::kPERIOD) {
10797 ConsumeToken(); // Consume the kPERIOD token. 10796 ConsumeToken(); // Consume the kPERIOD token.
10798 ExpectIdentifier("identifier expected after '.'"); 10797 ExpectIdentifier("identifier expected after '.'");
10799 } 10798 }
10800 } 10799 }
10801 10800
10802 } // namespace dart 10801 } // namespace dart
OLDNEW
« runtime/vm/object.cc ('K') | « runtime/vm/object.cc ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698