| 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 Setlet<Node> get superUses; | 9 Setlet<Node> get superUses; |
| 10 | 10 |
| (...skipping 4623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4634 } else { | 4634 } else { |
| 4635 internalError(node.receiver, 'unexpected element $element'); | 4635 internalError(node.receiver, 'unexpected element $element'); |
| 4636 } | 4636 } |
| 4637 return element; | 4637 return element; |
| 4638 } | 4638 } |
| 4639 | 4639 |
| 4640 Element visitIdentifier(Identifier node) { | 4640 Element visitIdentifier(Identifier node) { |
| 4641 String name = node.source; | 4641 String name = node.source; |
| 4642 Element element = resolver.reportLookupErrorIfAny( | 4642 Element element = resolver.reportLookupErrorIfAny( |
| 4643 lookupInScope(compiler, node, resolver.scope, name), node, name); | 4643 lookupInScope(compiler, node, resolver.scope, name), node, name); |
| 4644 resolver.useElement(node, element); |
| 4644 // TODO(johnniwinther): Change errors to warnings, cf. 11.11.1. | 4645 // TODO(johnniwinther): Change errors to warnings, cf. 11.11.1. |
| 4645 if (element == null) { | 4646 if (element == null) { |
| 4646 return failOrReturnErroneousElement(resolver.enclosingElement, node, name, | 4647 return failOrReturnErroneousElement(resolver.enclosingElement, node, name, |
| 4647 MessageKind.CANNOT_RESOLVE, | 4648 MessageKind.CANNOT_RESOLVE, |
| 4648 {'name': name}); | 4649 {'name': name}); |
| 4649 } else if (element.isErroneous()) { | 4650 } else if (element.isErroneous()) { |
| 4650 return element; | 4651 return element; |
| 4651 } else if (element.isTypedef()) { | 4652 } else if (element.isTypedef()) { |
| 4652 error(node, MessageKind.CANNOT_INSTANTIATE_TYPEDEF, | 4653 error(node, MessageKind.CANNOT_INSTANTIATE_TYPEDEF, |
| 4653 {'typedefName': name}); | 4654 {'typedefName': name}); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4666 return finishConstructorReference(visit(expression), | 4667 return finishConstructorReference(visit(expression), |
| 4667 expression, expression); | 4668 expression, expression); |
| 4668 } | 4669 } |
| 4669 } | 4670 } |
| 4670 | 4671 |
| 4671 /// Looks up [name] in [scope] and unwraps the result. | 4672 /// Looks up [name] in [scope] and unwraps the result. |
| 4672 Element lookupInScope(Compiler compiler, Node node, | 4673 Element lookupInScope(Compiler compiler, Node node, |
| 4673 Scope scope, String name) { | 4674 Scope scope, String name) { |
| 4674 return Elements.unwrap(scope.lookup(name), compiler, node); | 4675 return Elements.unwrap(scope.lookup(name), compiler, node); |
| 4675 } | 4676 } |
| OLD | NEW |