diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-01 11:34:28 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-13 20:11:13 -0500 |
| commit | 14c0a708cc33245d86d48b99d7dc93a6f5b9d20d (patch) | |
| tree | 3152f2717309fcee3fed6fe12da4874a65735767 /src/libsyntax | |
| parent | 444fa1b7cffcd99ca5b8abb51acf979f06a25899 (diff) | |
| download | rust-14c0a708cc33245d86d48b99d7dc93a6f5b9d20d.tar.gz rust-14c0a708cc33245d86d48b99d7dc93a6f5b9d20d.zip | |
syntax/ast_util: add `is_by_value_binop()`
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_util.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 7579972c6d8..71ce4847922 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -85,6 +85,16 @@ pub fn is_shift_binop(b: BinOp) -> bool { } } +/// Returns `true` is the binary operator takes its arguments by value +pub fn is_by_value_binop(b: BinOp) -> bool { + match b { + BiAdd | BiSub | BiMul | BiDiv | BiRem | BiBitXor | BiBitAnd | BiBitOr | BiShl | BiShr => { + true + } + _ => false + } +} + pub fn unop_to_string(op: UnOp) -> &'static str { match op { UnUniq => "box() ", |
