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

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

Issue 319833002: Improve error message and suggest workaround for mixin limitation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | « 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) 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 2524 matching lines...) Expand 10 before | Expand all | Expand 10 after
2535 if (current_class().is_mixin_app_alias() || 2535 if (current_class().is_mixin_app_alias() ||
2536 current_class().IsMixinApplication()) { 2536 current_class().IsMixinApplication()) {
2537 // At this point we don't support forwarding constructors 2537 // At this point we don't support forwarding constructors
2538 // that have optional parameters because we don't know the default 2538 // that have optional parameters because we don't know the default
2539 // values of the optional parameters. We would have to compile the super 2539 // values of the optional parameters. We would have to compile the super
2540 // constructor to get the default values. Also, the spec is not clear 2540 // constructor to get the default values. Also, the spec is not clear
2541 // whether optional parameters are even allowed in this situation. 2541 // whether optional parameters are even allowed in this situation.
2542 // TODO(hausner): Remove this limitation if the language spec indeed 2542 // TODO(hausner): Remove this limitation if the language spec indeed
2543 // allows optional parameters. 2543 // allows optional parameters.
2544 if (func.HasOptionalParameters()) { 2544 if (func.HasOptionalParameters()) {
2545 const Class& super_class = Class::Handle(I, current_class().SuperClass());
2545 ErrorMsg(ctor_pos, 2546 ErrorMsg(ctor_pos,
2546 "forwarding constructors must not have optional parameters"); 2547 "cannot generate an implicit mixin application constructor "
2548 "forwarding to a super class constructor with optional "
2549 "parameters; add a constructor without optional parameters "
2550 "to class '%s' that redirects to the constructor with optional "
2551 "parameters and invoke it via super from a constructor of the "
2552 "class extending the mixin application",
2553 String::Handle(I, super_class.Name()).ToCString());
2547 } 2554 }
2548 2555
2549 // Prepare user-defined arguments to be forwarded to super call. 2556 // Prepare user-defined arguments to be forwarded to super call.
2550 // The first user-defined argument is at position 2. 2557 // The first user-defined argument is at position 2.
2551 forwarding_args = new ArgumentListNode(Scanner::kNoSourcePos); 2558 forwarding_args = new ArgumentListNode(Scanner::kNoSourcePos);
2552 for (int i = 2; i < func.NumParameters(); i++) { 2559 for (int i = 2; i < func.NumParameters(); i++) {
2553 LocalVariable* param = new LocalVariable( 2560 LocalVariable* param = new LocalVariable(
2554 Scanner::kNoSourcePos, 2561 Scanner::kNoSourcePos,
2555 String::ZoneHandle(I, func.ParameterNameAt(i)), 2562 String::ZoneHandle(I, func.ParameterNameAt(i)),
2556 Type::ZoneHandle(I, Type::DynamicType())); 2563 Type::ZoneHandle(I, Type::DynamicType()));
(...skipping 8475 matching lines...) Expand 10 before | Expand all | Expand 10 after
11032 void Parser::SkipQualIdent() { 11039 void Parser::SkipQualIdent() {
11033 ASSERT(IsIdentifier()); 11040 ASSERT(IsIdentifier());
11034 ConsumeToken(); 11041 ConsumeToken();
11035 if (CurrentToken() == Token::kPERIOD) { 11042 if (CurrentToken() == Token::kPERIOD) {
11036 ConsumeToken(); // Consume the kPERIOD token. 11043 ConsumeToken(); // Consume the kPERIOD token.
11037 ExpectIdentifier("identifier expected after '.'"); 11044 ExpectIdentifier("identifier expected after '.'");
11038 } 11045 }
11039 } 11046 }
11040 11047
11041 } // namespace dart 11048 } // 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