| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 abstract class TreeElements { | 7 abstract class TreeElements { |
| 8 Element get currentElement; | 8 Element get currentElement; |
| 9 Set<Node> get superUses; | 9 Set<Node> get superUses; |
| 10 | 10 |
| (...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2097 if (target == null || target.isInstanceMember()) { | 2097 if (target == null || target.isInstanceMember()) { |
| 2098 compiler.backend.registerThrowNoSuchMethod(mapping); | 2098 compiler.backend.registerThrowNoSuchMethod(mapping); |
| 2099 // TODO(johnniwinther): With the simplified [TreeElements] invariant, | 2099 // TODO(johnniwinther): With the simplified [TreeElements] invariant, |
| 2100 // try to resolve injected elements if [currentClass] is in the patch | 2100 // try to resolve injected elements if [currentClass] is in the patch |
| 2101 // library of [receiverClass]. | 2101 // library of [receiverClass]. |
| 2102 | 2102 |
| 2103 // TODO(karlklose): this should be reported by the caller of | 2103 // TODO(karlklose): this should be reported by the caller of |
| 2104 // [resolveSend] to select better warning messages for getters and | 2104 // [resolveSend] to select better warning messages for getters and |
| 2105 // setters. | 2105 // setters. |
| 2106 MessageKind kind = (target == null) | 2106 MessageKind kind = (target == null) |
| 2107 ? MessageKind.METHOD_NOT_FOUND | 2107 ? MessageKind.MEMBER_NOT_FOUND |
| 2108 : MessageKind.MEMBER_NOT_STATIC; | 2108 : MessageKind.MEMBER_NOT_STATIC; |
| 2109 return warnAndCreateErroneousElement(node, name, kind, | 2109 return warnAndCreateErroneousElement(node, name, kind, |
| 2110 {'className': receiverClass.name, | 2110 {'className': receiverClass.name, |
| 2111 'memberName': name}); | 2111 'memberName': name}); |
| 2112 } | 2112 } |
| 2113 } else if (identical(resolvedReceiver.kind, ElementKind.PREFIX)) { | 2113 } else if (identical(resolvedReceiver.kind, ElementKind.PREFIX)) { |
| 2114 PrefixElement prefix = resolvedReceiver; | 2114 PrefixElement prefix = resolvedReceiver; |
| 2115 target = prefix.lookupLocalMember(name); | 2115 target = prefix.lookupLocalMember(name); |
| 2116 if (Elements.isUnresolved(target)) { | 2116 if (Elements.isUnresolved(target)) { |
| 2117 compiler.backend.registerThrowNoSuchMethod(mapping); | 2117 compiler.backend.registerThrowNoSuchMethod(mapping); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2243 compiler.backend.registerThrowNoSuchMethod(mapping); | 2243 compiler.backend.registerThrowNoSuchMethod(mapping); |
| 2244 target = | 2244 target = |
| 2245 warnAndCreateErroneousElement(node.selector, field.name, | 2245 warnAndCreateErroneousElement(node.selector, field.name, |
| 2246 MessageKind.CANNOT_RESOLVE_GETTER); | 2246 MessageKind.CANNOT_RESOLVE_GETTER); |
| 2247 } | 2247 } |
| 2248 } else if (target.isTypeVariable()) { | 2248 } else if (target.isTypeVariable()) { |
| 2249 ClassElement cls = target.getEnclosingClass(); | 2249 ClassElement cls = target.getEnclosingClass(); |
| 2250 assert(enclosingElement.getEnclosingClass() == cls); | 2250 assert(enclosingElement.getEnclosingClass() == cls); |
| 2251 compiler.backend.registerClassUsingVariableExpression(cls); | 2251 compiler.backend.registerClassUsingVariableExpression(cls); |
| 2252 compiler.backend.registerTypeVariableExpression(mapping); | 2252 compiler.backend.registerTypeVariableExpression(mapping); |
| 2253 // Set the type of the node to [Type] to mark this send as a |
| 2254 // type variable expression. |
| 2255 mapping.setType(node, compiler.typeClass.computeType(compiler)); |
| 2253 } else if (target.impliesType() && !sendIsMemberAccess) { | 2256 } else if (target.impliesType() && !sendIsMemberAccess) { |
| 2254 // Set the type of the node to [Type] to mark this send as a | 2257 // Set the type of the node to [Type] to mark this send as a |
| 2255 // type literal. | 2258 // type literal. |
| 2256 mapping.setType(node, compiler.typeClass.computeType(compiler)); | 2259 mapping.setType(node, compiler.typeClass.computeType(compiler)); |
| 2257 world.registerTypeLiteral(target, mapping); | 2260 world.registerTypeLiteral(target, mapping); |
| 2258 } | 2261 } |
| 2259 } | 2262 } |
| 2260 | 2263 |
| 2261 bool resolvedArguments = false; | 2264 bool resolvedArguments = false; |
| 2262 if (node.isOperator) { | 2265 if (node.isOperator) { |
| (...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4030 return e; | 4033 return e; |
| 4031 } | 4034 } |
| 4032 | 4035 |
| 4033 /// Assumed to be called by [resolveRedirectingFactory]. | 4036 /// Assumed to be called by [resolveRedirectingFactory]. |
| 4034 Element visitReturn(Return node) { | 4037 Element visitReturn(Return node) { |
| 4035 Node expression = node.expression; | 4038 Node expression = node.expression; |
| 4036 return finishConstructorReference(visit(expression), | 4039 return finishConstructorReference(visit(expression), |
| 4037 expression, expression); | 4040 expression, expression); |
| 4038 } | 4041 } |
| 4039 } | 4042 } |
| OLD | NEW |