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

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

Issue 24896002: Support forwarding constructors for mixin typedefs (issue 11888). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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
« no previous file with comments | « runtime/vm/parser.h ('k') | tests/language/language.status » ('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 "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 2443
2444 // Parse expressions of instance fields that have an explicit 2444 // Parse expressions of instance fields that have an explicit
2445 // initializer expression. 2445 // initializer expression.
2446 // The receiver must not be visible to field initializer expressions. 2446 // The receiver must not be visible to field initializer expressions.
2447 receiver->set_invisible(true); 2447 receiver->set_invisible(true);
2448 GrowableArray<Field*> initialized_fields; 2448 GrowableArray<Field*> initialized_fields;
2449 ParseInitializedInstanceFields( 2449 ParseInitializedInstanceFields(
2450 current_class(), receiver, &initialized_fields); 2450 current_class(), receiver, &initialized_fields);
2451 receiver->set_invisible(false); 2451 receiver->set_invisible(false);
2452 2452
2453 // If the class of this implicit constructor is a mixin typedef class,
2454 // it is a forwarding constructor of the aliased mixin application class.
2453 // If the class of this implicit constructor is a mixin application class, 2455 // If the class of this implicit constructor is a mixin application class,
2454 // it is a forwarding constructor of the mixin. The forwarding 2456 // it is a forwarding constructor of the mixin. The forwarding
2455 // constructor initializes the instance fields that have initializer 2457 // constructor initializes the instance fields that have initializer
2456 // expressions and then calls the respective super constructor with 2458 // expressions and then calls the respective super constructor with
2457 // the same name and number of parameters. 2459 // the same name and number of parameters.
2458 ArgumentListNode* forwarding_args = NULL; 2460 ArgumentListNode* forwarding_args = NULL;
2459 if (current_class().IsMixinApplication()) { 2461 if (current_class().is_mixin_typedef() ||
2462 current_class().IsMixinApplication()) {
2460 // At this point we don't support forwarding constructors 2463 // At this point we don't support forwarding constructors
2461 // that have optional parameters because we don't know the default 2464 // that have optional parameters because we don't know the default
2462 // values of the optional parameters. We would have to compile the super 2465 // values of the optional parameters. We would have to compile the super
2463 // constructor to get the default values. Also, the spec is not clear 2466 // constructor to get the default values. Also, the spec is not clear
2464 // whether optional parameters are even allowed in this situation. 2467 // whether optional parameters are even allowed in this situation.
2465 // TODO(hausner): Remove this limitation if the language spec indeed 2468 // TODO(hausner): Remove this limitation if the language spec indeed
2466 // allows optional parameters. 2469 // allows optional parameters.
2467 if (func.HasOptionalParameters()) { 2470 if (func.HasOptionalParameters()) {
2468 ErrorMsg(ctor_pos, 2471 ErrorMsg(ctor_pos,
2469 "forwarding constructors must not have optional parameters"); 2472 "forwarding constructors must not have optional parameters");
(...skipping 8130 matching lines...) Expand 10 before | Expand all | Expand 10 after
10600 void Parser::SkipQualIdent() { 10603 void Parser::SkipQualIdent() {
10601 ASSERT(IsIdentifier()); 10604 ASSERT(IsIdentifier());
10602 ConsumeToken(); 10605 ConsumeToken();
10603 if (CurrentToken() == Token::kPERIOD) { 10606 if (CurrentToken() == Token::kPERIOD) {
10604 ConsumeToken(); // Consume the kPERIOD token. 10607 ConsumeToken(); // Consume the kPERIOD token.
10605 ExpectIdentifier("identifier expected after '.'"); 10608 ExpectIdentifier("identifier expected after '.'");
10606 } 10609 }
10607 } 10610 }
10608 10611
10609 } // namespace dart 10612 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.h ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698