| 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 library dart2js.resolution; | 5 library dart2js.resolution; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show | 10 import '../common/names.dart' show |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 FunctionElement constructor, | 127 FunctionElement constructor, |
| 128 FunctionElement redirection) { | 128 FunctionElement redirection) { |
| 129 assert(invariant(node, constructor.isImplementation, | 129 assert(invariant(node, constructor.isImplementation, |
| 130 message: 'Redirecting constructors must be resolved on implementation ' | 130 message: 'Redirecting constructors must be resolved on implementation ' |
| 131 'elements.')); | 131 'elements.')); |
| 132 Setlet<FunctionElement> seen = new Setlet<FunctionElement>(); | 132 Setlet<FunctionElement> seen = new Setlet<FunctionElement>(); |
| 133 seen.add(constructor); | 133 seen.add(constructor); |
| 134 while (redirection != null) { | 134 while (redirection != null) { |
| 135 // Ensure that we follow redirections through implementation elements. | 135 // Ensure that we follow redirections through implementation elements. |
| 136 redirection = redirection.implementation; | 136 redirection = redirection.implementation; |
| 137 if (redirection.isError) { |
| 138 break; |
| 139 } |
| 137 if (seen.contains(redirection)) { | 140 if (seen.contains(redirection)) { |
| 138 reporter.reportErrorMessage( | 141 reporter.reportErrorMessage( |
| 139 node, MessageKind.REDIRECTING_CONSTRUCTOR_CYCLE); | 142 node, MessageKind.REDIRECTING_CONSTRUCTOR_CYCLE); |
| 140 return; | 143 return; |
| 141 } | 144 } |
| 142 seen.add(redirection); | 145 seen.add(redirection); |
| 143 redirection = resolver.visitor.resolveConstructorRedirection(redirection); | 146 redirection = resolver.visitor.resolveConstructorRedirection(redirection); |
| 144 } | 147 } |
| 145 } | 148 } |
| 146 | 149 |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 TreeElements get treeElements { | 1094 TreeElements get treeElements { |
| 1092 assert(invariant(this, _treeElements !=null, | 1095 assert(invariant(this, _treeElements !=null, |
| 1093 message: "TreeElements have not been computed for $this.")); | 1096 message: "TreeElements have not been computed for $this.")); |
| 1094 return _treeElements; | 1097 return _treeElements; |
| 1095 } | 1098 } |
| 1096 | 1099 |
| 1097 void reuseElement() { | 1100 void reuseElement() { |
| 1098 _treeElements = null; | 1101 _treeElements = null; |
| 1099 } | 1102 } |
| 1100 } | 1103 } |
| OLD | NEW |