| 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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 DartType resolveReturnType(Element element, TypeAnnotation annotation) { | 518 DartType resolveReturnType(Element element, TypeAnnotation annotation) { |
| 519 if (annotation == null) return compiler.types.dynamicType; | 519 if (annotation == null) return compiler.types.dynamicType; |
| 520 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); | 520 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); |
| 521 if (result == null) { | 521 if (result == null) { |
| 522 // TODO(karklose): warning. | 522 // TODO(karklose): warning. |
| 523 return compiler.types.dynamicType; | 523 return compiler.types.dynamicType; |
| 524 } | 524 } |
| 525 return result; | 525 return result; |
| 526 } | 526 } |
| 527 | 527 |
| 528 void resolveRedirectionChain(FunctionElement constructor, Node node) { | 528 void resolveRedirectionChain(FunctionElement constructor, Spannable node) { |
| 529 FunctionElementX current = constructor; | 529 FunctionElementX current = constructor; |
| 530 List<Element> seen = new List<Element>(); | 530 List<Element> seen = new List<Element>(); |
| 531 // Follow the chain of redirections and check for cycles. | 531 // Follow the chain of redirections and check for cycles. |
| 532 while (current != current.defaultImplementation) { | 532 while (current != current.defaultImplementation) { |
| 533 if (current.internalRedirectionTarget != null) { | 533 if (current.internalRedirectionTarget != null) { |
| 534 // We found a constructor that already has been processed. | 534 // We found a constructor that already has been processed. |
| 535 current = current.internalRedirectionTarget; | 535 current = current.internalRedirectionTarget; |
| 536 break; | 536 break; |
| 537 } | 537 } |
| 538 Element target = current.defaultImplementation; | 538 Element target = current.defaultImplementation; |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 node.accept(visitor); | 1071 node.accept(visitor); |
| 1072 annotation.value = compiler.constantHandler.compileNodeWithDefinitions( | 1072 annotation.value = compiler.constantHandler.compileNodeWithDefinitions( |
| 1073 node, visitor.mapping, isConst: true); | 1073 node, visitor.mapping, isConst: true); |
| 1074 compiler.backend.registerMetadataConstant(annotation.value, | 1074 compiler.backend.registerMetadataConstant(annotation.value, |
| 1075 visitor.mapping); | 1075 visitor.mapping); |
| 1076 | 1076 |
| 1077 annotation.resolutionState = STATE_DONE; | 1077 annotation.resolutionState = STATE_DONE; |
| 1078 })); | 1078 })); |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 error(Node node, MessageKind kind, [arguments = const {}]) { | 1081 error(Spannable node, MessageKind kind, [arguments = const {}]) { |
| 1082 // TODO(ahe): Make non-fatal. | 1082 // TODO(ahe): Make non-fatal. |
| 1083 compiler.reportFatalError(node, kind, arguments); | 1083 compiler.reportFatalError(node, kind, arguments); |
| 1084 } | 1084 } |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 class ConstantMapper extends Visitor { | 1087 class ConstantMapper extends Visitor { |
| 1088 final Map<Constant, Node> constantToNodeMap = new Map<Constant, Node>(); | 1088 final Map<Constant, Node> constantToNodeMap = new Map<Constant, Node>(); |
| 1089 final CompileTimeConstantEvaluator evaluator; | 1089 final CompileTimeConstantEvaluator evaluator; |
| 1090 | 1090 |
| 1091 ConstantMapper(ConstantHandler handler, | 1091 ConstantMapper(ConstantHandler handler, |
| (...skipping 3405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4497 return e; | 4497 return e; |
| 4498 } | 4498 } |
| 4499 | 4499 |
| 4500 /// Assumed to be called by [resolveRedirectingFactory]. | 4500 /// Assumed to be called by [resolveRedirectingFactory]. |
| 4501 Element visitReturn(Return node) { | 4501 Element visitReturn(Return node) { |
| 4502 Node expression = node.expression; | 4502 Node expression = node.expression; |
| 4503 return finishConstructorReference(visit(expression), | 4503 return finishConstructorReference(visit(expression), |
| 4504 expression, expression); | 4504 expression, expression); |
| 4505 } | 4505 } |
| 4506 } | 4506 } |
| OLD | NEW |