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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 /// Creates a result for the [constant] expression. [node] is provided for | 84 /// Creates a result for the [constant] expression. [node] is provided for |
85 /// error reporting on the constant and [element] is provided if the | 85 /// error reporting on the constant and [element] is provided if the |
86 /// expression additionally serves an [Element] like [ElementResult]. | 86 /// expression additionally serves an [Element] like [ElementResult]. |
87 ConstantResult(this.node, this.constant, {this.element}); | 87 ConstantResult(this.node, this.constant, {this.element}); |
88 | 88 |
89 bool get isConstant => true; | 89 bool get isConstant => true; |
90 | 90 |
91 ResultKind get kind => ResultKind.CONSTANT; | 91 ResultKind get kind => ResultKind.CONSTANT; |
92 | 92 |
93 String toString() => 'ConstantResult(${constant.getText()})'; | 93 String toString() => 'ConstantResult(${constant.toDartText()})'; |
94 } | 94 } |
95 | 95 |
96 class NoneResult extends ResolutionResult { | 96 class NoneResult extends ResolutionResult { |
97 const NoneResult(); | 97 const NoneResult(); |
98 | 98 |
99 ResultKind get kind => ResultKind.NONE; | 99 ResultKind get kind => ResultKind.NONE; |
100 | 100 |
101 String toString() => 'NoneResult()'; | 101 String toString() => 'NoneResult()'; |
102 } | 102 } |
103 | 103 |
(...skipping 14 matching lines...) Expand all Loading... |
118 | 118 |
119 /// Returns the list of [ConstantExpression]s for each of the arguments. If | 119 /// Returns the list of [ConstantExpression]s for each of the arguments. If |
120 /// [isValidAsConstant] is `false`, `null` is returned. | 120 /// [isValidAsConstant] is `false`, `null` is returned. |
121 List<ConstantExpression> get constantArguments { | 121 List<ConstantExpression> get constantArguments { |
122 if (!isValidAsConstant) return null; | 122 if (!isValidAsConstant) return null; |
123 return argumentResults.map((ResolutionResult result) { | 123 return argumentResults.map((ResolutionResult result) { |
124 return result.constant; | 124 return result.constant; |
125 }).toList(); | 125 }).toList(); |
126 } | 126 } |
127 } | 127 } |
OLD | NEW |