| 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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 DartType resolveReturnType(Element element, TypeAnnotation annotation) { | 596 DartType resolveReturnType(Element element, TypeAnnotation annotation) { |
| 597 if (annotation == null) return compiler.types.dynamicType; | 597 if (annotation == null) return compiler.types.dynamicType; |
| 598 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); | 598 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); |
| 599 if (result == null) { | 599 if (result == null) { |
| 600 // TODO(karklose): warning. | 600 // TODO(karklose): warning. |
| 601 return compiler.types.dynamicType; | 601 return compiler.types.dynamicType; |
| 602 } | 602 } |
| 603 return result; | 603 return result; |
| 604 } | 604 } |
| 605 | 605 |
| 606 void resolveRedirectionChain(FunctionElement constructor, Node node) { | 606 void resolveRedirectionChain(FunctionElement constructor, Spannable node) { |
| 607 FunctionElementX current = constructor; | 607 FunctionElementX current = constructor; |
| 608 List<Element> seen = new List<Element>(); | 608 List<Element> seen = new List<Element>(); |
| 609 // Follow the chain of redirections and check for cycles. | 609 // Follow the chain of redirections and check for cycles. |
| 610 while (current != current.defaultImplementation) { | 610 while (current != current.defaultImplementation) { |
| 611 if (current.internalRedirectionTarget != null) { | 611 if (current.internalRedirectionTarget != null) { |
| 612 // We found a constructor that already has been processed. | 612 // We found a constructor that already has been processed. |
| 613 current = current.internalRedirectionTarget; | 613 current = current.internalRedirectionTarget; |
| 614 break; | 614 break; |
| 615 } | 615 } |
| 616 Element target = current.defaultImplementation; | 616 Element target = current.defaultImplementation; |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 node.accept(visitor); | 1149 node.accept(visitor); |
| 1150 annotation.value = compiler.constantHandler.compileNodeWithDefinitions( | 1150 annotation.value = compiler.constantHandler.compileNodeWithDefinitions( |
| 1151 node, visitor.mapping, isConst: true); | 1151 node, visitor.mapping, isConst: true); |
| 1152 compiler.backend.registerMetadataConstant(annotation.value, | 1152 compiler.backend.registerMetadataConstant(annotation.value, |
| 1153 visitor.mapping); | 1153 visitor.mapping); |
| 1154 | 1154 |
| 1155 annotation.resolutionState = STATE_DONE; | 1155 annotation.resolutionState = STATE_DONE; |
| 1156 })); | 1156 })); |
| 1157 } | 1157 } |
| 1158 | 1158 |
| 1159 error(Node node, MessageKind kind, [arguments = const {}]) { | 1159 error(Spannable node, MessageKind kind, [arguments = const {}]) { |
| 1160 // TODO(ahe): Make non-fatal. | 1160 // TODO(ahe): Make non-fatal. |
| 1161 compiler.reportFatalError(node, kind, arguments); | 1161 compiler.reportFatalError(node, kind, arguments); |
| 1162 } | 1162 } |
| 1163 } | 1163 } |
| 1164 | 1164 |
| 1165 class ConstantMapper extends Visitor { | 1165 class ConstantMapper extends Visitor { |
| 1166 final Map<Constant, Node> constantToNodeMap = new Map<Constant, Node>(); | 1166 final Map<Constant, Node> constantToNodeMap = new Map<Constant, Node>(); |
| 1167 final CompileTimeConstantEvaluator evaluator; | 1167 final CompileTimeConstantEvaluator evaluator; |
| 1168 | 1168 |
| 1169 ConstantMapper(ConstantHandler handler, | 1169 ConstantMapper(ConstantHandler handler, |
| (...skipping 3490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4660 return finishConstructorReference(visit(expression), | 4660 return finishConstructorReference(visit(expression), |
| 4661 expression, expression); | 4661 expression, expression); |
| 4662 } | 4662 } |
| 4663 } | 4663 } |
| 4664 | 4664 |
| 4665 /// Looks up [name] in [scope] and unwraps the result. | 4665 /// Looks up [name] in [scope] and unwraps the result. |
| 4666 Element lookupInScope(Compiler compiler, Node node, | 4666 Element lookupInScope(Compiler compiler, Node node, |
| 4667 Scope scope, SourceString name) { | 4667 Scope scope, SourceString name) { |
| 4668 return Elements.unwrap(scope.lookup(name), compiler, node); | 4668 return Elements.unwrap(scope.lookup(name), compiler, node); |
| 4669 } | 4669 } |
| OLD | NEW |