Macro op
macro_rules! op { (unary,"-") => { ... }; (unary,"+") => { ... }; ("!") => { ... }; ("~") => { ... }; ("typeof") => { ... }; ("void") => { ... }; ("delete") => { ... }; ("++") => { ... }; ("--") => { ... }; ("==") => { ... }; ("!=") => { ... }; ("===") => { ... }; ("!==") => { ... }; ("<") => { ... }; ("<=") => { ... }; (">") => { ... }; (">=") => { ... }; ("<<") => { ... }; (">>") => { ... }; (">>>") => { ... }; (bin,"+") => { ... }; (bin,"-") => { ... }; ("*") => { ... }; ("/") => { ... }; ("%") => { ... }; ("|") => { ... }; ("^") => { ... }; ("&") => { ... }; ("||") => { ... }; ("&&") => { ... }; ("in") => { ... }; ("instanceof") => { ... }; ("**") => { ... }; ("??") => { ... }; ("=") => { ... }; ("+=") => { ... }; ("-=") => { ... }; ("*=") => { ... }; ("/=") => { ... }; ("%=") => { ... }; ("<<=") => { ... }; (">>=") => { ... }; (">>>=") => { ... }; ("|=") => { ... }; ("^=") => { ... }; ("&=") => { ... }; ("**=") => { ... }; ("&&=") => { ... }; ("||=") => { ... }; ("??=") => { ... }; }
Available on crate features
__ecma
and __visit
only.Expand description
Creates a corresponding operator. This macro is used to make code more readable.
This can used to represent UnaryOp, BinaryOp, or AssignOp.
Actual type is determined by the input.
ยงNote about +
and -
As this macro is intended to be used in anywhere, including pattern
bindings, this macro cannot use trick to determine type for +
and -
.
So we have to use some special syntax for +
and -
: