diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-15 15:49:41 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-18 14:56:00 -0500 |
| commit | 7efaf3fa343776d547d87984ab47bc26bc1f59a0 (patch) | |
| tree | 24e786e91623bc6b82473a7bf0a2a7dc063bc359 /src/libsyntax | |
| parent | f9a48492a82f805aa40d8b6fea290badbab0d1b1 (diff) | |
| download | rust-7efaf3fa343776d547d87984ab47bc26bc1f59a0.tar.gz rust-7efaf3fa343776d547d87984ab47bc26bc1f59a0.zip | |
syntax/ast_util: add `is_by_value_unop()`
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_util.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index aaa172633be..5243f07f327 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -85,7 +85,7 @@ pub fn is_shift_binop(b: BinOp) -> bool { } } -/// Returns `true` is the binary operator takes its arguments by value +/// Returns `true` if 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 => { @@ -95,6 +95,14 @@ pub fn is_by_value_binop(b: BinOp) -> bool { } } +/// Returns `true` if the unary operator takes its argument by value +pub fn is_by_value_unop(u: UnOp) -> bool { + match u { + UnNeg | UnNot => true, + _ => false, + } +} + pub fn unop_to_string(op: UnOp) -> &'static str { match op { UnUniq => "box() ", |
