Chromium Code Reviews| Index: pkg/analyzer/lib/src/summary/link.dart |
| diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart |
| index 13f590229d23c245fae57f3fe739343c3b019c2c..55d0fa49b69af08c1c72388310ea98c89f009679 100644 |
| --- a/pkg/analyzer/lib/src/summary/link.dart |
| +++ b/pkg/analyzer/lib/src/summary/link.dart |
| @@ -2182,7 +2182,8 @@ class ExprTypeComputer { |
| void _computePrefixExpressionType(String operatorName) { |
| DartType operand = stack.removeLast(); |
| if (operand is InterfaceType) { |
| - MethodElement method = operand.lookUpMethod(operatorName, library); |
| + MethodElement method = operand.lookUpInheritedMethod(operatorName, |
| + library: library, thisType: true); |
|
scheglov
2016/05/25 20:21:21
"thisType" is already true by default.
Paul Berry
2016/05/25 20:28:12
Thanks. Fixed.
|
| if (method != null) { |
| DartType type = method.returnType; |
| stack.add(type); |
| @@ -2268,7 +2269,8 @@ class ExprTypeComputer { |
| DartType target = stack.removeLast(); |
| stack.add(() { |
| if (target is InterfaceType) { |
| - MethodElement method = target.lookUpMethod('[]', library); |
| + MethodElement method = target.lookUpInheritedMethod('[]', |
| + library: library, thisType: true); |
| if (method != null) { |
| return method.returnType; |
| } |
| @@ -2282,14 +2284,15 @@ class ExprTypeComputer { |
| String propertyName = _getNextString(); |
| stack.add(() { |
| if (target is InterfaceType) { |
| - PropertyAccessorElement getter = |
| - target.lookUpGetter(propertyName, library); |
| - if (getter != null) { |
| - return getter.returnType; |
| - } |
| - MethodElement method = target.lookUpMethod(propertyName, library); |
| - if (method != null) { |
| - return method.type; |
| + ExecutableElement element = target |
| + .lookUpInheritedGetterOrMethod(propertyName, library: library); |
| + if (element != null) { |
| + if (element is PropertyAccessorElement) { |
| + return element.returnType; |
| + } else { |
| + // Method tear-off |
| + return element.type; |
| + } |
| } |
| } |
| return DynamicTypeImpl.instance; |
| @@ -2334,7 +2337,8 @@ class ExprTypeComputer { |
| DartType target = stack.removeLast(); |
| stack.add(() { |
| if (target is InterfaceType) { |
| - MethodElement method = target.lookUpMethod(methodName, library); |
| + MethodElement method = target.lookUpInheritedMethod(methodName, |
| + library: library, thisType: true); |
| FunctionType rawType = method?.type; |
| FunctionType inferredType = _inferExecutableType(rawType, numNamed, |
| numPositional, namedArgNames, namedArgTypeList, positionalArgTypes); |
| @@ -2454,7 +2458,10 @@ class ExprTypeComputer { |
| */ |
| DartType _getPropertyType(DartType targetType, String propertyName) { |
| return targetType is InterfaceType |
| - ? targetType.lookUpGetter(propertyName, library)?.returnType |
| + ? targetType |
| + .lookUpInheritedGetter(propertyName, |
| + library: library, thisType: true) |
| + ?.returnType |
| : DynamicTypeImpl.instance; |
| } |
| @@ -2518,7 +2525,8 @@ class ExprTypeComputer { |
| void _pushBinaryOperatorType( |
| DartType left, TokenType operator, DartType right) { |
| if (left is InterfaceType) { |
| - MethodElement method = left.lookUpMethod(operator.lexeme, library); |
| + MethodElement method = left.lookUpInheritedMethod(operator.lexeme, |
| + library: library, thisType: true); |
| if (method != null) { |
| DartType type = method.returnType; |
| type = linker.typeSystem.refineBinaryExpressionType( |
| @@ -3608,14 +3616,15 @@ class NonstaticMemberElementForLink extends Object |
| if (_library._linker.strongMode) { |
| DartType targetType = _target.asStaticType; |
| if (targetType is InterfaceType) { |
| - PropertyAccessorElement getter = |
| - targetType.lookUpGetter(_name, _library); |
| - if (getter != null) { |
| - return getter.returnType; |
| - } |
| - MethodElement method = targetType.lookUpMethod(_name, _library); |
| - if (method != null) { |
| - return method.type; |
| + ExecutableElement element = |
| + targetType.lookUpInheritedGetterOrMethod(_name, library: _library); |
| + if (element != null) { |
| + if (element is PropertyAccessorElement) { |
| + return element.returnType; |
| + } else { |
| + // Method tear-off |
| + return element.type; |
| + } |
| } |
| } |
| // TODO(paulberry): handle .call on function types and .toString or |