| 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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 DartType resolveReturnType(Element element, TypeAnnotation annotation) { | 576 DartType resolveReturnType(Element element, TypeAnnotation annotation) { |
| 577 if (annotation == null) return compiler.types.dynamicType; | 577 if (annotation == null) return compiler.types.dynamicType; |
| 578 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); | 578 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); |
| 579 if (result == null) { | 579 if (result == null) { |
| 580 // TODO(karklose): warning. | 580 // TODO(karklose): warning. |
| 581 return compiler.types.dynamicType; | 581 return compiler.types.dynamicType; |
| 582 } | 582 } |
| 583 return result; | 583 return result; |
| 584 } | 584 } |
| 585 | 585 |
| 586 void resolveRedirectionChain(FunctionElement constructor, Node node) { | 586 void resolveRedirectionChain(FunctionElement constructor, Spannable node) { |
| 587 FunctionElementX current = constructor; | 587 FunctionElementX current = constructor; |
| 588 List<Element> seen = new List<Element>(); | 588 List<Element> seen = new List<Element>(); |
| 589 // Follow the chain of redirections and check for cycles. | 589 // Follow the chain of redirections and check for cycles. |
| 590 while (current != current.defaultImplementation) { | 590 while (current != current.defaultImplementation) { |
| 591 if (current.internalRedirectionTarget != null) { | 591 if (current.internalRedirectionTarget != null) { |
| 592 // We found a constructor that already has been processed. | 592 // We found a constructor that already has been processed. |
| 593 current = current.internalRedirectionTarget; | 593 current = current.internalRedirectionTarget; |
| 594 break; | 594 break; |
| 595 } | 595 } |
| 596 Element target = current.defaultImplementation; | 596 Element target = current.defaultImplementation; |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 node.accept(visitor); | 1129 node.accept(visitor); |
| 1130 annotation.value = compiler.constantHandler.compileNodeWithDefinitions( | 1130 annotation.value = compiler.constantHandler.compileNodeWithDefinitions( |
| 1131 node, visitor.mapping, isConst: true); | 1131 node, visitor.mapping, isConst: true); |
| 1132 compiler.backend.registerMetadataConstant(annotation.value, | 1132 compiler.backend.registerMetadataConstant(annotation.value, |
| 1133 visitor.mapping); | 1133 visitor.mapping); |
| 1134 | 1134 |
| 1135 annotation.resolutionState = STATE_DONE; | 1135 annotation.resolutionState = STATE_DONE; |
| 1136 })); | 1136 })); |
| 1137 } | 1137 } |
| 1138 | 1138 |
| 1139 error(Node node, MessageKind kind, [arguments = const {}]) { | 1139 error(Spannable node, MessageKind kind, [arguments = const {}]) { |
| 1140 // TODO(ahe): Make non-fatal. | 1140 // TODO(ahe): Make non-fatal. |
| 1141 compiler.reportFatalError(node, kind, arguments); | 1141 compiler.reportFatalError(node, kind, arguments); |
| 1142 } | 1142 } |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 class ConstantMapper extends Visitor { | 1145 class ConstantMapper extends Visitor { |
| 1146 final Map<Constant, Node> constantToNodeMap = new Map<Constant, Node>(); | 1146 final Map<Constant, Node> constantToNodeMap = new Map<Constant, Node>(); |
| 1147 final CompileTimeConstantEvaluator evaluator; | 1147 final CompileTimeConstantEvaluator evaluator; |
| 1148 | 1148 |
| 1149 ConstantMapper(ConstantHandler handler, | 1149 ConstantMapper(ConstantHandler handler, |
| (...skipping 3492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4642 return finishConstructorReference(visit(expression), | 4642 return finishConstructorReference(visit(expression), |
| 4643 expression, expression); | 4643 expression, expression); |
| 4644 } | 4644 } |
| 4645 } | 4645 } |
| 4646 | 4646 |
| 4647 /// Looks up [name] in [scope] and unwraps the result. | 4647 /// Looks up [name] in [scope] and unwraps the result. |
| 4648 Element lookupInScope(Compiler compiler, Node node, | 4648 Element lookupInScope(Compiler compiler, Node node, |
| 4649 Scope scope, SourceString name) { | 4649 Scope scope, SourceString name) { |
| 4650 return Elements.unwrap(scope.lookup(name), compiler, node); | 4650 return Elements.unwrap(scope.lookup(name), compiler, node); |
| 4651 } | 4651 } |
| OLD | NEW |