| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "tools/gn/operators.h" | 5 #include "tools/gn/operators.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 return Value(); | 412 return Value(); |
| 413 } | 413 } |
| 414 | 414 |
| 415 // Left is passed by value because it will be modified in-place and returned | 415 // Left is passed by value because it will be modified in-place and returned |
| 416 // for the list case. | 416 // for the list case. |
| 417 Value ExecuteMinus(const BinaryOpNode* op_node, | 417 Value ExecuteMinus(const BinaryOpNode* op_node, |
| 418 Value left, | 418 Value left, |
| 419 const Value& right, | 419 const Value& right, |
| 420 Err* err) { | 420 Err* err) { |
| 421 // Left-hand-side int. The only thing to do is subtract another int. | 421 // Left-hand-side int. The only thing to do is subtract another int. |
| 422 if (left.type() == Value::INTEGER && right.type() != Value::INTEGER) { | 422 if (left.type() == Value::INTEGER && right.type() == Value::INTEGER) { |
| 423 // Int - int -> subtraction. | 423 // Int - int -> subtraction. |
| 424 return Value(op_node, left.int_value() - right.int_value()); | 424 return Value(op_node, left.int_value() - right.int_value()); |
| 425 } | 425 } |
| 426 | 426 |
| 427 // Left-hand-side list. The only thing to do is subtract another list. | 427 // Left-hand-side list. The only thing to do is subtract another list. |
| 428 if (left.type() == Value::LIST && right.type() == Value::LIST) { | 428 if (left.type() == Value::LIST && right.type() == Value::LIST) { |
| 429 // In-place modify left and return it. | 429 // In-place modify left and return it. |
| 430 RemoveMatchesFromList(op_node, &left, right, err); | 430 RemoveMatchesFromList(op_node, &left, right, err); |
| 431 return left; | 431 return left; |
| 432 } | 432 } |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 return ExecuteGreaterEquals(scope, op_node, left_value, right_value, err); | 774 return ExecuteGreaterEquals(scope, op_node, left_value, right_value, err); |
| 775 if (op.type() == Token::LESS_EQUAL) | 775 if (op.type() == Token::LESS_EQUAL) |
| 776 return ExecuteLessEquals(scope, op_node, left_value, right_value, err); | 776 return ExecuteLessEquals(scope, op_node, left_value, right_value, err); |
| 777 if (op.type() == Token::GREATER_THAN) | 777 if (op.type() == Token::GREATER_THAN) |
| 778 return ExecuteGreater(scope, op_node, left_value, right_value, err); | 778 return ExecuteGreater(scope, op_node, left_value, right_value, err); |
| 779 if (op.type() == Token::LESS_THAN) | 779 if (op.type() == Token::LESS_THAN) |
| 780 return ExecuteLess(scope, op_node, left_value, right_value, err); | 780 return ExecuteLess(scope, op_node, left_value, right_value, err); |
| 781 | 781 |
| 782 return Value(); | 782 return Value(); |
| 783 } | 783 } |
| OLD | NEW |