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

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

Issue 12620002: Emit compile time error on static non-members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reword warning and move it before the crash messages. Created 7 years, 9 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 | sdk/lib/_internal/compiler/implementation/warnings.dart » ('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 ed986ed2d190767c86265e5430907b22e3824358..5985ca83ee78b8e2008806658c3472aaacd6f20b 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -1821,8 +1821,13 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
}
void setupFunction(FunctionExpression node, FunctionElement function) {
- scope = new MethodScope(scope, function);
+ Element enclosingElement = function.enclosingElement;
+ if (node.modifiers.isStatic() &&
+ enclosingElement.kind != ElementKind.CLASS) {
+ compiler.reportErrorCode(node, MessageKind.ILLEGAL_STATIC);
+ }
+ scope = new MethodScope(scope, function);
// Put the parameters in scope.
FunctionSignature functionParameters =
function.computeSignature(compiler);
« 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