| 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 DartType resolveReturnType(Element element, TypeAnnotation annotation) { | 521 DartType resolveReturnType(Element element, TypeAnnotation annotation) { |
| 522 if (annotation == null) return compiler.types.dynamicType; | 522 if (annotation == null) return compiler.types.dynamicType; |
| 523 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); | 523 DartType result = visitorFor(element).resolveTypeAnnotation(annotation); |
| 524 if (result == null) { | 524 if (result == null) { |
| 525 // TODO(karklose): warning. | 525 // TODO(karklose): warning. |
| 526 return compiler.types.dynamicType; | 526 return compiler.types.dynamicType; |
| 527 } | 527 } |
| 528 return result; | 528 return result; |
| 529 } | 529 } |
| 530 | 530 |
| 531 void resolveRedirectionChain(FunctionElement constructor, Node node) { | 531 void resolveRedirectionChain(FunctionElement constructor, Spannable node) { |
| 532 FunctionElementX current = constructor; | 532 FunctionElementX current = constructor; |
| 533 List<Element> seen = new List<Element>(); | 533 List<Element> seen = new List<Element>(); |
| 534 // Follow the chain of redirections and check for cycles. | 534 // Follow the chain of redirections and check for cycles. |
| 535 while (current != current.defaultImplementation) { | 535 while (current != current.defaultImplementation) { |
| 536 if (current.internalRedirectionTarget != null) { | 536 if (current.internalRedirectionTarget != null) { |
| 537 // We found a constructor that already has been processed. | 537 // We found a constructor that already has been processed. |
| 538 current = current.internalRedirectionTarget; | 538 current = current.internalRedirectionTarget; |
| 539 break; | 539 break; |
| 540 } | 540 } |
| 541 Element target = current.defaultImplementation; | 541 Element target = current.defaultImplementation; |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 node.accept(visitor); | 1074 node.accept(visitor); |
| 1075 annotation.value = compiler.constantHandler.compileNodeWithDefinitions( | 1075 annotation.value = compiler.constantHandler.compileNodeWithDefinitions( |
| 1076 node, visitor.mapping, isConst: true); | 1076 node, visitor.mapping, isConst: true); |
| 1077 compiler.backend.registerMetadataConstant(annotation.value, | 1077 compiler.backend.registerMetadataConstant(annotation.value, |
| 1078 visitor.mapping); | 1078 visitor.mapping); |
| 1079 | 1079 |
| 1080 annotation.resolutionState = STATE_DONE; | 1080 annotation.resolutionState = STATE_DONE; |
| 1081 })); | 1081 })); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 error(Node node, MessageKind kind, [arguments = const {}]) { | 1084 error(Spannable node, MessageKind kind, [arguments = const {}]) { |
| 1085 // TODO(ahe): Make non-fatal. | 1085 // TODO(ahe): Make non-fatal. |
| 1086 compiler.reportFatalError(node, kind, arguments); | 1086 compiler.reportFatalError(node, kind, arguments); |
| 1087 } | 1087 } |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 class ConstantMapper extends Visitor { | 1090 class ConstantMapper extends Visitor { |
| 1091 final Map<Constant, Node> constantToNodeMap = new Map<Constant, Node>(); | 1091 final Map<Constant, Node> constantToNodeMap = new Map<Constant, Node>(); |
| 1092 final CompileTimeConstantEvaluator evaluator; | 1092 final CompileTimeConstantEvaluator evaluator; |
| 1093 | 1093 |
| 1094 ConstantMapper(ConstantHandler handler, | 1094 ConstantMapper(ConstantHandler handler, |
| (...skipping 3425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4520 return finishConstructorReference(visit(expression), | 4520 return finishConstructorReference(visit(expression), |
| 4521 expression, expression); | 4521 expression, expression); |
| 4522 } | 4522 } |
| 4523 } | 4523 } |
| 4524 | 4524 |
| 4525 /// Looks up [name] in [scope] and unwraps the result. | 4525 /// Looks up [name] in [scope] and unwraps the result. |
| 4526 Element lookupInScope(Compiler compiler, Node node, | 4526 Element lookupInScope(Compiler compiler, Node node, |
| 4527 Scope scope, SourceString name) { | 4527 Scope scope, SourceString name) { |
| 4528 return Elements.unwrap(scope.lookup(name), compiler, node); | 4528 return Elements.unwrap(scope.lookup(name), compiler, node); |
| 4529 } | 4529 } |
| OLD | NEW |