OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.result; | 5 library dart2js.resolution.result; |
6 | 6 |
7 import '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
8 import '../dart_types.dart'; | 8 import '../dart_types.dart'; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../tree/tree.dart'; | 10 import '../tree/tree.dart'; |
11 import '../universe/call_structure.dart' show CallStructure; | 11 import '../universe/call_structure.dart' show CallStructure; |
12 | 12 |
13 enum ResultKind { NONE, ELEMENT, TYPE, ASSERT, CONSTANT, PREFIX, } | 13 enum ResultKind { |
| 14 NONE, |
| 15 ELEMENT, |
| 16 TYPE, |
| 17 ASSERT, |
| 18 CONSTANT, |
| 19 PREFIX, |
| 20 } |
14 | 21 |
15 /// The result of resolving a node. | 22 /// The result of resolving a node. |
16 abstract class ResolutionResult { | 23 abstract class ResolutionResult { |
17 const ResolutionResult(); | 24 const ResolutionResult(); |
18 | 25 |
19 // TODO(johnniwinther): Remove this factory constructor when `null` is never | 26 // TODO(johnniwinther): Remove this factory constructor when `null` is never |
20 // passed as an element result. | 27 // passed as an element result. |
21 factory ResolutionResult.forElement(Element element) { | 28 factory ResolutionResult.forElement(Element element) { |
22 return element != null ? new ElementResult(element) : const NoneResult(); | 29 return element != null ? new ElementResult(element) : const NoneResult(); |
23 } | 30 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 125 |
119 /// Returns the list of [ConstantExpression]s for each of the arguments. If | 126 /// Returns the list of [ConstantExpression]s for each of the arguments. If |
120 /// [isValidAsConstant] is `false`, `null` is returned. | 127 /// [isValidAsConstant] is `false`, `null` is returned. |
121 List<ConstantExpression> get constantArguments { | 128 List<ConstantExpression> get constantArguments { |
122 if (!isValidAsConstant) return null; | 129 if (!isValidAsConstant) return null; |
123 return argumentResults.map((ResolutionResult result) { | 130 return argumentResults.map((ResolutionResult result) { |
124 return result.constant; | 131 return result.constant; |
125 }).toList(); | 132 }).toList(); |
126 } | 133 } |
127 } | 134 } |
OLD | NEW |