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

Unified Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 1172693003: Move computeType to TypedElement and TypeDeclarationElement. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | « pkg/compiler/lib/src/resolution/class_members.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/members.dart
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index 27dda38d8150b044756529368e0c2db331daabea..577cfbf425586841ef82dbea544a4e82384516f1 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -759,7 +759,14 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
type = registry.getType(node.selector);
}
if (type == null) {
- type = target.computeType(compiler);
+ if (target.isTypedef || target.isClass) {
+ TypeDeclarationElement typeDeclaration = target;
+ typeDeclaration.computeType(compiler);
+ type = typeDeclaration.rawType;
+ } else {
+ TypeVariableElement typeVariable = target;
+ type = typeVariable.type;
+ }
}
registry.registerTypeLiteral(node, type);
@@ -1719,17 +1726,20 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
ResolutionResult handleStaticOrTopLevelAccess(
Send node, Name name, Element element) {
+ MemberElement member;
if (element.isAbstractField) {
AbstractFieldElement abstractField = element;
if (abstractField.getter != null) {
- element = abstractField.getter;
+ member = abstractField.getter;
} else {
- element = abstractField.setter;
+ member = abstractField.setter;
}
+ } else {
+ member = element;
}
// TODO(johnniwinther): Needed to provoke a parsing and with it discovery
// of parse errors to make [element] erroneous. Fix this!
- element.computeType(compiler);
+ member.computeType(compiler);
Selector selector;
CallStructure callStructure = CallStructure.NO_ARGS;
@@ -1740,7 +1750,7 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
selector = new Selector(SelectorKind.GETTER, name, callStructure);
}
AccessSemantics semantics =
- computeStaticOrTopLevelAccessSemantics(node, element);
+ computeStaticOrTopLevelAccessSemantics(node, member);
if (node.isCall) {
bool isIncompatibleInvoke = false;
switch (semantics.kind) {
@@ -1771,7 +1781,7 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
case AccessKind.TOPLEVEL_SETTER:
case AccessKind.UNRESOLVED:
registry.registerThrowNoSuchMethod();
- element = reportAndCreateErroneousElement(
+ member = reportAndCreateErroneousElement(
node.selector, name.text,
MessageKind.CANNOT_RESOLVE_GETTER, const {});
break;
@@ -1805,7 +1815,7 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
case AccessKind.TOPLEVEL_SETTER:
case AccessKind.UNRESOLVED:
registry.registerThrowNoSuchMethod();
- element = reportAndCreateErroneousElement(
+ member = reportAndCreateErroneousElement(
node.selector, name.text,
MessageKind.CANNOT_RESOLVE_GETTER, const {});
break;
@@ -1820,11 +1830,11 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
// TODO(johnniwinther): Remove these when all information goes through
// the [SendStructure].
- registry.useElement(node, element);
+ registry.useElement(node, member);
registry.setSelector(node, selector);
return node.isPropertyAccess
- ? new ElementResult(element) : const NoneResult();
+ ? new ElementResult(member) : const NoneResult();
}
/// Handle access to resolved [element].
« no previous file with comments | « pkg/compiler/lib/src/resolution/class_members.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698