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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/language_dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 1fd0b735fd95470f9e080d6097ebe1db3d687f45..aba2213c581e3c1b60005ae7c3cca65202e2c4c1 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -2510,7 +2510,11 @@ class ResolverVisitor extends MappingVisitor<Element> {
}
} else if (target.impliesType()) {
compiler.backend.registerThrowNoSuchMethod(mapping);
- } else if (target.modifiers.isFinal() || target.modifiers.isConst()) {
+ } else if (target.modifiers.isFinal() ||
+ target.modifiers.isConst() ||
+ (target.isFunction() &&
+ Elements.isStaticOrTopLevelFunction(target) &&
+ !target.isSetter())) {
setter = warnAndCreateErroneousElement(
node.selector, target.name, MessageKind.CANNOT_RESOLVE_SETTER);
compiler.backend.registerThrowNoSuchMethod(mapping);
« 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