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

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

Issue 24589002: Emit a warning and runtime error when assigning to a function. (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 | tests/language/language_dart2js.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 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 2492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2503 node.selector, field.name, MessageKind.CANNOT_RESOLVE_SETTER); 2503 node.selector, field.name, MessageKind.CANNOT_RESOLVE_SETTER);
2504 compiler.backend.registerThrowNoSuchMethod(mapping); 2504 compiler.backend.registerThrowNoSuchMethod(mapping);
2505 } 2505 }
2506 if (isComplex && getter == null && !inInstanceContext) { 2506 if (isComplex && getter == null && !inInstanceContext) {
2507 getter = warnAndCreateErroneousElement( 2507 getter = warnAndCreateErroneousElement(
2508 node.selector, field.name, MessageKind.CANNOT_RESOLVE_GETTER); 2508 node.selector, field.name, MessageKind.CANNOT_RESOLVE_GETTER);
2509 compiler.backend.registerThrowNoSuchMethod(mapping); 2509 compiler.backend.registerThrowNoSuchMethod(mapping);
2510 } 2510 }
2511 } else if (target.impliesType()) { 2511 } else if (target.impliesType()) {
2512 compiler.backend.registerThrowNoSuchMethod(mapping); 2512 compiler.backend.registerThrowNoSuchMethod(mapping);
2513 } else if (target.modifiers.isFinal() || target.modifiers.isConst()) { 2513 } else if (target.modifiers.isFinal() ||
2514 target.modifiers.isConst() ||
2515 (target.isFunction() &&
2516 Elements.isStaticOrTopLevelFunction(target) &&
2517 !target.isSetter())) {
2514 setter = warnAndCreateErroneousElement( 2518 setter = warnAndCreateErroneousElement(
2515 node.selector, target.name, MessageKind.CANNOT_RESOLVE_SETTER); 2519 node.selector, target.name, MessageKind.CANNOT_RESOLVE_SETTER);
2516 compiler.backend.registerThrowNoSuchMethod(mapping); 2520 compiler.backend.registerThrowNoSuchMethod(mapping);
2517 } 2521 }
2518 } 2522 }
2519 2523
2520 visit(node.argumentsNode); 2524 visit(node.argumentsNode);
2521 2525
2522 // TODO(ngeoffray): Check if the target can be assigned. 2526 // TODO(ngeoffray): Check if the target can be assigned.
2523 // TODO(ngeoffray): Warn if target is null and the send is 2527 // TODO(ngeoffray): Warn if target is null and the send is
(...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after
4378 return e; 4382 return e;
4379 } 4383 }
4380 4384
4381 /// Assumed to be called by [resolveRedirectingFactory]. 4385 /// Assumed to be called by [resolveRedirectingFactory].
4382 Element visitReturn(Return node) { 4386 Element visitReturn(Return node) {
4383 Node expression = node.expression; 4387 Node expression = node.expression;
4384 return finishConstructorReference(visit(expression), 4388 return finishConstructorReference(visit(expression),
4385 expression, expression); 4389 expression, expression);
4386 } 4390 }
4387 } 4391 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698