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

Unified Diff: tools/gn/operators.cc

Issue 214883005: Add Skia to the GN build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: tools/gn/operators.cc
diff --git a/tools/gn/operators.cc b/tools/gn/operators.cc
index 5824ac3d23de98cd6ca1bcf4a3fa513f1cbfa433..d22b7d15bb04fddaa78f22abef80fdc9bb294c74 100644
--- a/tools/gn/operators.cc
+++ b/tools/gn/operators.cc
@@ -416,11 +416,15 @@ Value ExecuteOr(Scope* scope,
const Value& right,
Err* err) {
if (left.type() != Value::BOOLEAN) {
- *err = Err(left, "Left side of || operator is not a boolean.");
- err->AppendRange(op_node->GetRange());
+ *err = Err(op_node->left(), "Left side of || operator is not a boolean.",
+ "Type is \"" + std::string(Value::DescribeType(left.type())) +
+ "\" instead.");
+ return Value();
} else if (right.type() != Value::BOOLEAN) {
- *err = Err(right, "Right side of || operator is not a boolean.");
- err->AppendRange(op_node->GetRange());
+ *err = Err(op_node->right(), "Right side of || operator is not a boolean.",
+ "Type is \"" + std::string(Value::DescribeType(right.type())) +
+ "\" instead.");
+ return Value();
}
return Value(op_node, left.boolean_value() || right.boolean_value());
}
@@ -431,11 +435,15 @@ Value ExecuteAnd(Scope* scope,
const Value& right,
Err* err) {
if (left.type() != Value::BOOLEAN) {
- *err = Err(left, "Left side of && operator is not a boolean.");
- err->AppendRange(op_node->GetRange());
+ *err = Err(op_node->left(), "Left side of && operator is not a boolean.",
+ "Type is \"" + std::string(Value::DescribeType(left.type())) +
+ "\" instead.");
+ return Value();
} else if (right.type() != Value::BOOLEAN) {
- *err = Err(right, "Right side of && operator is not a boolean.");
- err->AppendRange(op_node->GetRange());
+ *err = Err(op_node->right(), "Right side of && operator is not a boolean.",
+ "Type is \"" + std::string(Value::DescribeType(right.type())) +
+ "\" instead.");
+ return Value();
}
return Value(op_node, left.boolean_value() && right.boolean_value());
}
@@ -487,8 +495,9 @@ Value ExecuteUnaryOperator(Scope* scope,
DCHECK(op_node->op().type() == Token::BANG);
if (expr.type() != Value::BOOLEAN) {
- *err = Err(expr, "Operand of ! operator is not a boolean.");
- err->AppendRange(op_node->GetRange());
+ *err = Err(op_node, "Operand of ! operator is not a boolean.",
+ "Type is \"" + std::string(Value::DescribeType(expr.type())) +
+ "\" instead.");
return Value();
}
// TODO(scottmg): Why no unary minus?

Powered by Google App Engine
This is Rietveld 408576698