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'; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 assert(type != null); | 76 assert(type != null); |
77 } | 77 } |
78 | 78 |
79 ResultKind get kind => ResultKind.TYPE; | 79 ResultKind get kind => ResultKind.TYPE; |
80 | 80 |
81 Element get element => type.element; | 81 Element get element => type.element; |
82 | 82 |
83 String toString() => 'TypeResult($type)'; | 83 String toString() => 'TypeResult($type)'; |
84 } | 84 } |
85 | 85 |
| 86 /// The result for the resolution of the `assert` method. |
| 87 class AssertResult extends ResolutionResult { |
| 88 const AssertResult(); |
| 89 |
| 90 ResultKind get kind => ResultKind.ASSERT; |
| 91 |
| 92 String toString() => 'AssertResult()'; |
| 93 } |
| 94 |
86 /// The result for resolving a constant expression. | 95 /// The result for resolving a constant expression. |
87 class ConstantResult extends ResolutionResult { | 96 class ConstantResult extends ResolutionResult { |
88 final Node node; | 97 final Node node; |
89 final ConstantExpression constant; | 98 final ConstantExpression constant; |
90 final Element element; | 99 final Element element; |
91 | 100 |
92 /// Creates a result for the [constant] expression. [node] is provided for | 101 /// Creates a result for the [constant] expression. [node] is provided for |
93 /// error reporting on the constant and [element] is provided if the | 102 /// error reporting on the constant and [element] is provided if the |
94 /// expression additionally serves an [Element] like [ElementResult]. | 103 /// expression additionally serves an [Element] like [ElementResult]. |
95 ConstantResult(this.node, this.constant, {this.element}); | 104 ConstantResult(this.node, this.constant, {this.element}); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 {this.isValidAsConstant}); | 136 {this.isValidAsConstant}); |
128 | 137 |
129 /// Returns the list of [ConstantExpression]s for each of the arguments. If | 138 /// Returns the list of [ConstantExpression]s for each of the arguments. If |
130 /// [isValidAsConstant] is `false`, `null` is returned. | 139 /// [isValidAsConstant] is `false`, `null` is returned. |
131 List<ConstantExpression> get constantArguments { | 140 List<ConstantExpression> get constantArguments { |
132 if (!isValidAsConstant) return null; | 141 if (!isValidAsConstant) return null; |
133 return argumentResults.map((ResolutionResult result) { | 142 return argumentResults.map((ResolutionResult result) { |
134 return result.constant; | 143 return result.constant; |
135 }).toList(); | 144 }).toList(); |
136 } | 145 } |
137 } | 146 } |
OLD | NEW |