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

Side by Side Diff: tools/gn/operators.cc

Issue 740863003: gn: delete some dead code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-penalty-binop
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « tools/gn/operators.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "tools/gn/err.h" 8 #include "tools/gn/err.h"
9 #include "tools/gn/parse_tree.h" 9 #include "tools/gn/parse_tree.h"
10 #include "tools/gn/scope.h" 10 #include "tools/gn/scope.h"
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 "\" instead."); 484 "\" instead.");
485 return Value(); 485 return Value();
486 } 486 }
487 return Value(op_node, left.boolean_value() && right.boolean_value()); 487 return Value(op_node, left.boolean_value() && right.boolean_value());
488 } 488 }
489 489
490 } // namespace 490 } // namespace
491 491
492 // ---------------------------------------------------------------------------- 492 // ----------------------------------------------------------------------------
493 493
494 bool IsUnaryOperator(const Token& token) {
495 return token.type() == Token::BANG;
496 }
497
498 bool IsBinaryOperator(const Token& token) {
499 return token.type() == Token::EQUAL ||
500 token.type() == Token::PLUS ||
501 token.type() == Token::MINUS ||
502 token.type() == Token::PLUS_EQUALS ||
503 token.type() == Token::MINUS_EQUALS ||
504 token.type() == Token::EQUAL_EQUAL ||
505 token.type() == Token::NOT_EQUAL ||
506 token.type() == Token::LESS_EQUAL ||
507 token.type() == Token::GREATER_EQUAL ||
508 token.type() == Token::LESS_THAN ||
509 token.type() == Token::GREATER_THAN ||
510 token.type() == Token::BOOLEAN_AND ||
511 token.type() == Token::BOOLEAN_OR;
512 }
513
514 bool IsFunctionCallArgBeginScoper(const Token& token) {
515 return token.type() == Token::LEFT_PAREN;
516 }
517
518 bool IsFunctionCallArgEndScoper(const Token& token) {
519 return token.type() == Token::RIGHT_PAREN;
520 }
521
522 bool IsScopeBeginScoper(const Token& token) {
523 return token.type() == Token::LEFT_BRACE;
524 }
525
526 bool IsScopeEndScoper(const Token& token) {
527 return token.type() == Token::RIGHT_BRACE;
528 }
529
530 Value ExecuteUnaryOperator(Scope* scope, 494 Value ExecuteUnaryOperator(Scope* scope,
531 const UnaryOpNode* op_node, 495 const UnaryOpNode* op_node,
532 const Value& expr, 496 const Value& expr,
533 Err* err) { 497 Err* err) {
534 DCHECK(op_node->op().type() == Token::BANG); 498 DCHECK(op_node->op().type() == Token::BANG);
535 499
536 if (expr.type() != Value::BOOLEAN) { 500 if (expr.type() != Value::BOOLEAN) {
537 *err = Err(op_node, "Operand of ! operator is not a boolean.", 501 *err = Err(op_node, "Operand of ! operator is not a boolean.",
538 "Type is \"" + std::string(Value::DescribeType(expr.type())) + 502 "Type is \"" + std::string(Value::DescribeType(expr.type())) +
539 "\" instead."); 503 "\" instead.");
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 return ExecuteGreaterEquals(scope, op_node, left_value, right_value, err); 576 return ExecuteGreaterEquals(scope, op_node, left_value, right_value, err);
613 if (op.type() == Token::LESS_EQUAL) 577 if (op.type() == Token::LESS_EQUAL)
614 return ExecuteLessEquals(scope, op_node, left_value, right_value, err); 578 return ExecuteLessEquals(scope, op_node, left_value, right_value, err);
615 if (op.type() == Token::GREATER_THAN) 579 if (op.type() == Token::GREATER_THAN)
616 return ExecuteGreater(scope, op_node, left_value, right_value, err); 580 return ExecuteGreater(scope, op_node, left_value, right_value, err);
617 if (op.type() == Token::LESS_THAN) 581 if (op.type() == Token::LESS_THAN)
618 return ExecuteLess(scope, op_node, left_value, right_value, err); 582 return ExecuteLess(scope, op_node, left_value, right_value, err);
619 583
620 return Value(); 584 return Value();
621 } 585 }
OLDNEW
« no previous file with comments | « tools/gn/operators.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698