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

Unified Diff: lib/compiler/implementation/elements/elements.dart

Issue 10913081: Fix resolution of type parameters in static context, and the use of type parameters in closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « lib/compiler/implementation/closure.dart ('k') | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/elements/elements.dart
===================================================================
--- lib/compiler/implementation/elements/elements.dart (revision 11862)
+++ lib/compiler/implementation/elements/elements.dart (working copy)
@@ -648,9 +648,7 @@
DartType get type => variables.type;
- bool isInstanceMember() {
- return isMember() && !modifiers.isStatic();
- }
+ bool isInstanceMember() => variables.isInstanceMember();
// Note: cachedNode.getBeginToken() will not be correct in all
// cases, for example, for function typed parameters.
@@ -759,6 +757,19 @@
}
return result;
}
+
+ bool isInstanceMember() {
+ return isMember() && !modifiers.isStatic();
+ }
+
+ Scope buildScope() {
+ Scope result = new VariableScope(enclosingElement.buildScope(), this);
+ if (enclosingElement.isClass()) {
+ ClassScope clsScope = result.parent;
+ clsScope.inStaticContext = !isInstanceMember();
+ }
+ return result;
+ }
}
class ForeignElement extends Element {
@@ -985,6 +996,15 @@
result.type = type;
return result;
}
+
+ Scope buildScope() {
+ Scope result = new MethodScope(enclosingElement.buildScope(), this);
+ if (enclosingElement.isClass()) {
+ ClassScope clsScope = result.parent;
+ clsScope.inStaticContext = !isInstanceMember() && !isConstructor();
+ }
+ return result;
+ }
}
« no previous file with comments | « lib/compiler/implementation/closure.dart ('k') | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698