[breaking-change] don't glob export ast::BinOp_
This commit is contained in:
parent
f875f4c4c2
commit
05e25de4f0
12 changed files with 164 additions and 164 deletions
|
@ -10,7 +10,6 @@
|
|||
|
||||
// The Rust abstract syntax tree.
|
||||
|
||||
pub use self::BinOp_::*;
|
||||
pub use self::BlockCheckMode::*;
|
||||
pub use self::CaptureClause::*;
|
||||
pub use self::Decl_::*;
|
||||
|
@ -627,97 +626,99 @@ pub enum Mutability {
|
|||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
||||
pub enum BinOp_ {
|
||||
pub enum BinOpKind {
|
||||
/// The `+` operator (addition)
|
||||
BiAdd,
|
||||
Add,
|
||||
/// The `-` operator (subtraction)
|
||||
BiSub,
|
||||
Sub,
|
||||
/// The `*` operator (multiplication)
|
||||
BiMul,
|
||||
Mul,
|
||||
/// The `/` operator (division)
|
||||
BiDiv,
|
||||
Div,
|
||||
/// The `%` operator (modulus)
|
||||
BiRem,
|
||||
Rem,
|
||||
/// The `&&` operator (logical and)
|
||||
BiAnd,
|
||||
And,
|
||||
/// The `||` operator (logical or)
|
||||
BiOr,
|
||||
Or,
|
||||
/// The `^` operator (bitwise xor)
|
||||
BiBitXor,
|
||||
BitXor,
|
||||
/// The `&` operator (bitwise and)
|
||||
BiBitAnd,
|
||||
BitAnd,
|
||||
/// The `|` operator (bitwise or)
|
||||
BiBitOr,
|
||||
BitOr,
|
||||
/// The `<<` operator (shift left)
|
||||
BiShl,
|
||||
Shl,
|
||||
/// The `>>` operator (shift right)
|
||||
BiShr,
|
||||
Shr,
|
||||
/// The `==` operator (equality)
|
||||
BiEq,
|
||||
Eq,
|
||||
/// The `<` operator (less than)
|
||||
BiLt,
|
||||
Lt,
|
||||
/// The `<=` operator (less than or equal to)
|
||||
BiLe,
|
||||
Le,
|
||||
/// The `!=` operator (not equal to)
|
||||
BiNe,
|
||||
Ne,
|
||||
/// The `>=` operator (greater than or equal to)
|
||||
BiGe,
|
||||
Ge,
|
||||
/// The `>` operator (greater than)
|
||||
BiGt,
|
||||
Gt,
|
||||
}
|
||||
|
||||
impl BinOp_ {
|
||||
impl BinOpKind {
|
||||
pub fn to_string(&self) -> &'static str {
|
||||
use self::BinOpKind::*;
|
||||
match *self {
|
||||
BiAdd => "+",
|
||||
BiSub => "-",
|
||||
BiMul => "*",
|
||||
BiDiv => "/",
|
||||
BiRem => "%",
|
||||
BiAnd => "&&",
|
||||
BiOr => "||",
|
||||
BiBitXor => "^",
|
||||
BiBitAnd => "&",
|
||||
BiBitOr => "|",
|
||||
BiShl => "<<",
|
||||
BiShr => ">>",
|
||||
BiEq => "==",
|
||||
BiLt => "<",
|
||||
BiLe => "<=",
|
||||
BiNe => "!=",
|
||||
BiGe => ">=",
|
||||
BiGt => ">"
|
||||
Add => "+",
|
||||
Sub => "-",
|
||||
Mul => "*",
|
||||
Div => "/",
|
||||
Rem => "%",
|
||||
And => "&&",
|
||||
Or => "||",
|
||||
BitXor => "^",
|
||||
BitAnd => "&",
|
||||
BitOr => "|",
|
||||
Shl => "<<",
|
||||
Shr => ">>",
|
||||
Eq => "==",
|
||||
Lt => "<",
|
||||
Le => "<=",
|
||||
Ne => "!=",
|
||||
Ge => ">=",
|
||||
Gt => ">",
|
||||
}
|
||||
}
|
||||
pub fn lazy(&self) -> bool {
|
||||
match *self {
|
||||
BiAnd | BiOr => true,
|
||||
BinOpKind::And | BinOpKind::Or => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_shift(&self) -> bool {
|
||||
match *self {
|
||||
BiShl | BiShr => true,
|
||||
BinOpKind::Shl | BinOpKind::Shr => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
pub fn is_comparison(&self) -> bool {
|
||||
use self::BinOpKind::*;
|
||||
match *self {
|
||||
BiEq | BiLt | BiLe | BiNe | BiGt | BiGe =>
|
||||
Eq | Lt | Le | Ne | Gt | Ge =>
|
||||
true,
|
||||
BiAnd | BiOr | BiAdd | BiSub | BiMul | BiDiv | BiRem |
|
||||
BiBitXor | BiBitAnd | BiBitOr | BiShl | BiShr =>
|
||||
And | Or | Add | Sub | Mul | Div | Rem |
|
||||
BitXor | BitAnd | BitOr | Shl | Shr =>
|
||||
false,
|
||||
}
|
||||
}
|
||||
/// Returns `true` if the binary operator takes its arguments by value
|
||||
pub fn is_by_value(&self) -> bool {
|
||||
!BinOp_::is_comparison(self)
|
||||
!self.is_comparison()
|
||||
}
|
||||
}
|
||||
|
||||
pub type BinOp = Spanned<BinOp_>;
|
||||
pub type BinOp = Spanned<BinOpKind>;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
||||
pub enum UnOp {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue