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

Unified Diff: tools/testing/dart/status_expression.dart

Issue 78723002: Make sure variable names used in status files are available in the environment (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/status_expression.dart
diff --git a/tools/testing/dart/status_expression.dart b/tools/testing/dart/status_expression.dart
index 957924927416e8c2e5beee6be39af7a3989ea687..96396ea57da967948a96b403dda1ef36a42a64b2 100644
--- a/tools/testing/dart/status_expression.dart
+++ b/tools/testing/dart/status_expression.dart
@@ -30,6 +30,13 @@ library status_expression;
* to A if B is true, and to the empty set if B is false.
*/
+class ExprEvaluationException {
+ String error;
+
+ ExprEvaluationException(this.error);
+
+ toString() => error;
+}
class Token {
static const String LEFT_PAREN = "(";
@@ -97,7 +104,15 @@ class TermVariable {
TermVariable(this.name);
- String termValue(environment) => environment[name].toString();
+ String termValue(environment) {
+ var value = environment[name];
+ if (value == null) {
+ throw new ExprEvaluationException(
+ "Could not find '$name' in environment "
+ "while evaluating status file expression.");
+ }
+ return value.toString();
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698