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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 25023002: Emit a compile-time error if a function type parameter is declard with 'final' or 'var'. (Closed) Base URL: https://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 | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.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 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 Element get currentElement; 8 Element get currentElement;
9 Set<Node> get superUses; 9 Set<Node> get superUses;
10 10
(...skipping 4109 matching lines...) Expand 10 before | Expand all | Expand 10 after
4120 if (!defaultValuesAllowed) { 4120 if (!defaultValuesAllowed) {
4121 error(defaultValue, MessageKind.TYPEDEF_FORMAL_WITH_DEFAULT); 4121 error(defaultValue, MessageKind.TYPEDEF_FORMAL_WITH_DEFAULT);
4122 } 4122 }
4123 // Visit the value. The compile time constant handler will 4123 // Visit the value. The compile time constant handler will
4124 // make sure it's a compile time constant. 4124 // make sure it's a compile time constant.
4125 resolveExpression(defaultValue); 4125 resolveExpression(defaultValue);
4126 return element; 4126 return element;
4127 } 4127 }
4128 4128
4129 Element visitFunctionExpression(FunctionExpression node) { 4129 Element visitFunctionExpression(FunctionExpression node) {
4130 Modifiers modifiers = currentDefinitions.modifiers;
4131 if (modifiers.isFinal()) {
4132 compiler.reportError(modifiers,
4133 MessageKind.FINAL_FUNCTION_TYPE_PARAMETER);
4134 }
4135 if (modifiers.isVar()) {
4136 compiler.reportError(modifiers, MessageKind.VAR_FUNCTION_TYPE_PARAMETER);
4137 }
4130 // This is a function typed parameter. 4138 // This is a function typed parameter.
4131 // TODO(ahe): Resolve the function type. 4139 // TODO(ahe): Resolve the function type.
4132 return visit(node.name); 4140 return visit(node.name);
4133 } 4141 }
4134 4142
4135 LinkBuilder<Element> analyzeNodes(Link<Node> link) { 4143 LinkBuilder<Element> analyzeNodes(Link<Node> link) {
4136 LinkBuilder<Element> elements = new LinkBuilder<Element>(); 4144 LinkBuilder<Element> elements = new LinkBuilder<Element>();
4137 for (; !link.isEmpty; link = link.tail) { 4145 for (; !link.isEmpty; link = link.tail) {
4138 Element element = link.head.accept(this); 4146 Element element = link.head.accept(this);
4139 if (element != null) { 4147 if (element != null) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
4382 return e; 4390 return e;
4383 } 4391 }
4384 4392
4385 /// Assumed to be called by [resolveRedirectingFactory]. 4393 /// Assumed to be called by [resolveRedirectingFactory].
4386 Element visitReturn(Return node) { 4394 Element visitReturn(Return node) {
4387 Node expression = node.expression; 4395 Node expression = node.expression;
4388 return finishConstructorReference(visit(expression), 4396 return finishConstructorReference(visit(expression),
4389 expression, expression); 4397 expression, expression);
4390 } 4398 }
4391 } 4399 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698