| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart'; | 5 import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart'; |
| 6 import 'package:kernel/ast.dart' show Expression; | 6 import 'package:kernel/ast.dart' show Expression; |
| 7 | 7 |
| 8 /// Keeps track of state while determining whether an expression has an | 8 /// Keeps track of state while determining whether an expression has an |
| 9 /// immediately evident type, and if so what its dependencies are. | 9 /// immediately evident type, and if so what its dependencies are. |
| 10 /// | 10 /// |
| 11 /// This class describes the interface for use by clients of type inference. | 11 /// This class describes the interface for use by clients of type inference. |
| 12 /// The implementation is in [DependencyCollectorImpl]. | 12 /// The implementation is in [DependencyCollectorImpl]. |
| 13 abstract class DependencyCollector { | 13 abstract class DependencyCollector { |
| 14 /// Collects any dependencies of [expression], and reports errors if the | 14 /// Collects any dependencies of [expression], and reports errors if the |
| 15 /// expression does not have an immediately evident type. | 15 /// expression does not have an immediately evident type. |
| 16 void collectDependencies(Expression expression); | 16 void collectDependencies(Expression expression); |
| 17 } | 17 } |
| 18 | 18 |
| 19 /// Generic implementation of [DependencyCollectorImpl]. | 19 /// Generic implementation of [DependencyCollectorImpl]. |
| 20 /// | 20 /// |
| 21 /// This class contains all of the implementation of [DependencyCollector] which | 21 /// This class contains all of the implementation of [DependencyCollector] which |
| 22 /// can be expressed without the need to reference private data structures in | 22 /// can be expressed without the need to reference private data structures in |
| 23 /// the shadow hierarchy. | 23 /// the shadow hierarchy. |
| 24 abstract class DependencyCollectorImpl extends DependencyCollector { | 24 abstract class DependencyCollectorImpl extends DependencyCollector { |
| 25 List<FieldNode> dependencies = []; | 25 List<AccessorNode> dependencies = []; |
| 26 | 26 |
| 27 bool isImmediatelyEvident = true; | 27 bool isImmediatelyEvident = true; |
| 28 | 28 |
| 29 void recordDependency(FieldNode fieldNode) { | 29 void recordDependency(AccessorNode accessorNode) { |
| 30 dependencies.add(fieldNode); | 30 dependencies.add(accessorNode); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void recordNotImmediatelyEvident(int fileOffset) { | 33 void recordNotImmediatelyEvident(int fileOffset) { |
| 34 isImmediatelyEvident = false; | 34 isImmediatelyEvident = false; |
| 35 // TODO(paulberry): report an error. | 35 // TODO(paulberry): report an error. |
| 36 } | 36 } |
| 37 } | 37 } |
| OLD | NEW |