Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: pkg/compiler/lib/src/resolution/resolution_result.dart

Issue 1342213003: Add optional message to assert in Dart2js - continued (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add --assert-message flag Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
95 /// The result for resolving a constant expression. 86 /// The result for resolving a constant expression.
96 class ConstantResult extends ResolutionResult { 87 class ConstantResult extends ResolutionResult {
97 final Node node; 88 final Node node;
98 final ConstantExpression constant; 89 final ConstantExpression constant;
99 final Element element; 90 final Element element;
100 91
101 /// Creates a result for the [constant] expression. [node] is provided for 92 /// Creates a result for the [constant] expression. [node] is provided for
102 /// error reporting on the constant and [element] is provided if the 93 /// error reporting on the constant and [element] is provided if the
103 /// expression additionally serves an [Element] like [ElementResult]. 94 /// expression additionally serves an [Element] like [ElementResult].
104 ConstantResult(this.node, this.constant, {this.element}); 95 ConstantResult(this.node, this.constant, {this.element});
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 {this.isValidAsConstant}); 127 {this.isValidAsConstant});
137 128
138 /// Returns the list of [ConstantExpression]s for each of the arguments. If 129 /// Returns the list of [ConstantExpression]s for each of the arguments. If
139 /// [isValidAsConstant] is `false`, `null` is returned. 130 /// [isValidAsConstant] is `false`, `null` is returned.
140 List<ConstantExpression> get constantArguments { 131 List<ConstantExpression> get constantArguments {
141 if (!isValidAsConstant) return null; 132 if (!isValidAsConstant) return null;
142 return argumentResults.map((ResolutionResult result) { 133 return argumentResults.map((ResolutionResult result) {
143 return result.constant; 134 return result.constant;
144 }).toList(); 135 }).toList();
145 } 136 }
146 } 137 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/registry.dart ('k') | pkg/compiler/lib/src/resolution/semantic_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698