Browse Source

Removed long links

pull/293/head
HalidOdat 4 years ago
parent
commit
b6c83f3349
  1. 352
      boa/src/syntax/ast/op.rs

352
boa/src/syntax/ast/op.rs

@ -28,68 +28,74 @@ pub trait Operator {
pub enum NumOp { pub enum NumOp {
/// The addition operator produces the sum of numeric operands or string concatenation. /// The addition operator produces the sum of numeric operands or string concatenation.
/// ///
/// Syntax: `expression + expression` /// Syntax: `x + y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-addition-operator-plus>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-addition-operator-plus).
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Addition> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Addition
Add, Add,
/// The subtraction operator subtracts the two operands, producing their difference. /// The subtraction operator subtracts the two operands, producing their difference.
/// ///
/// Syntax: `expression - expression` /// Syntax: `x - y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-subtraction-operator-minus>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-subtraction-operator-minus).
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Subtraction> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Subtraction
Sub, Sub,
/// The division operator produces the quotient of its operands where the left operand /// The division operator produces the quotient of its operands where the left operand
/// is the dividend and the right operand is the divisor. /// is the dividend and the right operand is the divisor.
/// ///
/// Syntax: `expression / expression` /// Syntax: `x / y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-MultiplicativeOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-MultiplicativeOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Division> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Division
Div, Div,
/// The multiplication operator produces the product of the operands. /// The multiplication operator produces the product of the operands.
/// ///
/// Syntax: `expression * expression` /// Syntax: `x * y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-MultiplicativeExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-MultiplicativeExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Multiplication> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Multiplication
Mul, Mul,
/// The exponentiation operator returns the result of raising the first operand to /// The exponentiation operator returns the result of raising the first operand to
/// the power of the second operand. /// the power of the second operand.
/// ///
/// Syntax: `expression ** expression` /// Syntax: `x ** y`
/// ///
/// The exponentiation operator is right-associative. a ** b ** c is equal to a ** (b ** c). /// The exponentiation operator is right-associative. a ** b ** c is equal to a ** (b ** c).
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-exp-operator>. /// - [ECMAScript reference]: <https://tc39.es/ecma262/#sec-exp-operator>.
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Exponentiation> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Exponentiation
Exp, Exp,
/// The remainder operator returns the remainder left over when one operand is divided by a second operand. /// The remainder operator returns the remainder left over when one operand is divided by a second operand.
/// ///
/// Syntax: `expression % expression` /// Syntax: `x % y`
/// ///
/// The remainder operator always takes the sign of the dividend. /// The remainder operator always takes the sign of the dividend.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-MultiplicativeOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-MultiplicativeOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder
Mod, Mod,
} }
@ -117,9 +123,10 @@ impl Display for NumOp {
/// function calls. /// function calls.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-UnaryExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-UnaryExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Unary> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Unary
#[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)] #[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub enum UnaryOp { pub enum UnaryOp {
@ -130,9 +137,10 @@ pub enum UnaryOp {
/// This operator increments and returns the value after incrementing. /// This operator increments and returns the value after incrementing.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-postfix-increment-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-postfix-increment-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment
IncrementPost, IncrementPost,
/// The increment operator increments (adds one to) its operand and returns a value. /// The increment operator increments (adds one to) its operand and returns a value.
@ -142,9 +150,10 @@ pub enum UnaryOp {
/// This operator increments and returns the value before incrementing. /// This operator increments and returns the value before incrementing.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-prefix-increment-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-prefix-increment-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment
IncrementPre, IncrementPre,
/// The decrement operator decrements (subtracts one from) its operand and returns a value. /// The decrement operator decrements (subtracts one from) its operand and returns a value.
@ -154,9 +163,10 @@ pub enum UnaryOp {
/// This operator decrements and returns the value before decrementing. /// This operator decrements and returns the value before decrementing.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-postfix-decrement-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-postfix-decrement-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Decrement> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Decrement
DecrementPost, DecrementPost,
/// The decrement operator decrements (subtracts one from) its operand and returns a value. /// The decrement operator decrements (subtracts one from) its operand and returns a value.
@ -166,9 +176,10 @@ pub enum UnaryOp {
/// This operator decrements the operand and returns the value after decrementing. /// This operator decrements the operand and returns the value after decrementing.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-prefix-decrement-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-prefix-decrement-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Decrement> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Decrement
DecrementPre, DecrementPre,
/// The unary negation operator precedes its operand and negates it. /// The unary negation operator precedes its operand and negates it.
@ -179,9 +190,10 @@ pub enum UnaryOp {
/// however, it performs an additional operation, negation. /// however, it performs an additional operation, negation.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-unary-minus-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-unary-minus-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Unary_negation> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Unary_negation
Minus, Minus,
/// The unary plus operator attempts to convert the operand into a number, if it isn't already. /// The unary plus operator attempts to convert the operand into a number, if it isn't already.
@ -193,9 +205,10 @@ pub enum UnaryOp {
/// It can convert `string` representations of integers and floats, as well as the non-string values `true`, `false`, and `null`. /// It can convert `string` representations of integers and floats, as well as the non-string values `true`, `false`, and `null`.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-unary-plus-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-unary-plus-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Unary_plus> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Unary_plus
Plus, Plus,
/// Returns `false` if its single operand can be converted to `true`; otherwise, returns `true`. /// Returns `false` if its single operand can be converted to `true`; otherwise, returns `true`.
@ -208,9 +221,10 @@ pub enum UnaryOp {
/// force the conversion of any value to the corresponding boolean primitive. /// force the conversion of any value to the corresponding boolean primitive.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-logical-not-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-logical-not-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_NOT> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_NOT
Not, Not,
/// Performs the NOT operator on each bit. /// Performs the NOT operator on each bit.
@ -221,9 +235,10 @@ pub enum UnaryOp {
/// Bitwise NOTing any number x yields -(x + 1). For example, ~-5 yields 4. /// Bitwise NOTing any number x yields -(x + 1). For example, ~-5 yields 4.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-bitwise-not-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-bitwise-not-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_NOT> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_NOT
Tilde, Tilde,
/// The `typeof` operator returns a string indicating the type of the unevaluated operand. /// The `typeof` operator returns a string indicating the type of the unevaluated operand.
@ -235,9 +250,10 @@ pub enum UnaryOp {
/// There are other uses as well. /// There are other uses as well.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-typeof-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-typeof-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof
TypeOf, TypeOf,
/// The JavaScript `delete` operator removes a property from an object. /// The JavaScript `delete` operator removes a property from an object.
@ -254,9 +270,10 @@ pub enum UnaryOp {
/// property, in which case, `false` is returned in non-strict mode. /// property, in which case, `false` is returned in non-strict mode.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-delete-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-delete-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete
Delete, Delete,
/// The `void` operator evaluates the given `expression` and then returns `undefined`. /// The `void` operator evaluates the given `expression` and then returns `undefined`.
@ -272,9 +289,10 @@ pub enum UnaryOp {
/// `void` can be used to force the function keyword to be treated as an expression instead of a declaration. /// `void` can be used to force the function keyword to be treated as an expression instead of a declaration.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-void-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-void-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void
Void, Void,
} }
@ -302,8 +320,9 @@ impl Display for UnaryOp {
/// on bit patterns or binary numerals that involve the manipulation of individual bits. /// on bit patterns or binary numerals that involve the manipulation of individual bits.
/// ///
/// More information: /// More information:
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Bitwise> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Bitwise
#[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)] #[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub enum BitOp { pub enum BitOp {
@ -312,9 +331,10 @@ pub enum BitOp {
/// Syntax: `x & y` /// Syntax: `x & y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-BitwiseANDExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-BitwiseANDExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_AND> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_AND
And, And,
/// Performs the OR operation on each pair of bits. a OR b yields 1 if either a or b is 1. /// Performs the OR operation on each pair of bits. a OR b yields 1 if either a or b is 1.
@ -322,9 +342,10 @@ pub enum BitOp {
/// Syntax: `x | y` /// Syntax: `x | y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-BitwiseORExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-BitwiseORExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_OR> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_OR
Or, Or,
/// Performs the XOR operation on each pair of bits. a XOR b yields 1 if a and b are different. /// Performs the XOR operation on each pair of bits. a XOR b yields 1 if a and b are different.
@ -332,9 +353,10 @@ pub enum BitOp {
/// Syntax: `x ^ y` /// Syntax: `x ^ y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-BitwiseXORExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-BitwiseXORExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_XOR> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_XOR
Xor, Xor,
/// This operator shifts the first operand the specified number of bits to the left. /// This operator shifts the first operand the specified number of bits to the left.
@ -344,9 +366,10 @@ pub enum BitOp {
/// Excess bits shifted off to the left are discarded. Zero bits are shifted in from the right. /// Excess bits shifted off to the left are discarded. Zero bits are shifted in from the right.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-left-shift-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-left-shift-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Left_shift> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Left_shift
Shl, Shl,
/// This operator shifts the first operand the specified number of bits to the right. /// This operator shifts the first operand the specified number of bits to the right.
@ -359,9 +382,10 @@ pub enum BitOp {
/// Hence the name "sign-propagating". /// Hence the name "sign-propagating".
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-signed-right-shift-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-signed-right-shift-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Right_shift> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Right_shift
Shr, Shr,
/// This operator shifts the first operand the specified number of bits to the right. /// This operator shifts the first operand the specified number of bits to the right.
@ -373,9 +397,10 @@ pub enum BitOp {
/// Unlike the other bitwise operators, zero-fill right shift returns an unsigned 32-bit integer. /// Unlike the other bitwise operators, zero-fill right shift returns an unsigned 32-bit integer.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-unsigned-right-shift-operator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-unsigned-right-shift-operator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Unsigned_right_shift> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Unsigned_right_shift
UShr, UShr,
} }
@ -406,8 +431,10 @@ impl Display for BitOp {
/// to compatible types before checking equality. /// to compatible types before checking equality.
/// ///
/// More information: /// More information:
/// - MDN documentation: /// - [ECMAScript reference](tc39.es/ecma262/#sec-testing-and-comparison-operations)
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Comparison> /// - [MDN documentation][mdn]
///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Comparison
#[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)] #[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub enum CompOp { pub enum CompOp {
@ -419,9 +446,10 @@ pub enum CompOp {
/// refer to the same object in memory. /// refer to the same object in memory.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-abstract-equality-comparison>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-abstract-equality-comparison)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Equality> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Equality
Equal, Equal,
/// The inequality operator returns true if the operands are not equal. /// The inequality operator returns true if the operands are not equal.
@ -433,9 +461,10 @@ pub enum CompOp {
/// internal references which are not equal when operands refer to different objects in memory. /// internal references which are not equal when operands refer to different objects in memory.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-EqualityExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-EqualityExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Inequality> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Inequality
NotEqual, NotEqual,
/// The identity operator returns true if the operands are strictly equal **with no type conversion**. /// The identity operator returns true if the operands are strictly equal **with no type conversion**.
@ -445,9 +474,10 @@ pub enum CompOp {
/// Returns `true` if the operands are equal and of the same type. /// Returns `true` if the operands are equal and of the same type.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-strict-equality-comparison>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-strict-equality-comparison)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Identity> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Identity
StrictEqual, StrictEqual,
/// The non-identity operator returns true if the operands **are not equal and/or not of the same type**. /// The non-identity operator returns true if the operands **are not equal and/or not of the same type**.
@ -457,9 +487,10 @@ pub enum CompOp {
/// Returns `true` if the operands are of the same type but not equal, or are of different type. /// Returns `true` if the operands are of the same type but not equal, or are of different type.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-EqualityExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-EqualityExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Nonidentity> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Nonidentity>
StrictNotEqual, StrictNotEqual,
/// The greater than operator returns true if the left operand is greater than the right operand. /// The greater than operator returns true if the left operand is greater than the right operand.
@ -469,9 +500,10 @@ pub enum CompOp {
/// Returns `true` if the left operand is greater than the right operand. /// Returns `true` if the left operand is greater than the right operand.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-RelationalExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-RelationalExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Greater_than_operator> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Greater_than_operator
GreaterThan, GreaterThan,
/// The greater than or equal operator returns true if the left operand is greater than or equal to the right operand. /// The greater than or equal operator returns true if the left operand is greater than or equal to the right operand.
@ -481,9 +513,10 @@ pub enum CompOp {
/// Returns `true` if the left operand is greater than the right operand. /// Returns `true` if the left operand is greater than the right operand.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-RelationalExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-RelationalExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Greater_than_operator> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Greater_than_operator
GreaterThanOrEqual, GreaterThanOrEqual,
/// The less than operator returns true if the left operand is less than the right operand. /// The less than operator returns true if the left operand is less than the right operand.
@ -493,9 +526,10 @@ pub enum CompOp {
/// Returns `true` if the left operand is less than the right operand. /// Returns `true` if the left operand is less than the right operand.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-RelationalExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-RelationalExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Less_than_operator> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Less_than_operator
LessThan, LessThan,
/// The less than or equal operator returns true if the left operand is less than or equal to the right operand. /// The less than or equal operator returns true if the left operand is less than or equal to the right operand.
@ -505,9 +539,10 @@ pub enum CompOp {
/// Returns `true` if the left operand is less than or equal to the right operand. /// Returns `true` if the left operand is less than or equal to the right operand.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-RelationalExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-RelationalExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Less_than_or_equal_operator> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Less_than_or_equal_operator
LessThanOrEqual, LessThanOrEqual,
} }
@ -536,9 +571,10 @@ impl Display for CompOp {
/// so if these operators are used with non-Boolean values, they may return a non-Boolean value. /// so if these operators are used with non-Boolean values, they may return a non-Boolean value.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#sec-binary-logical-operators>. /// - [ECMAScript reference](https://tc39.es/ecma262/#sec-binary-logical-operators)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Logical> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Logical
#[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)] #[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub enum LogOp { pub enum LogOp {
@ -548,9 +584,10 @@ pub enum LogOp {
/// Syntax: `x && y` /// Syntax: `x && y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-LogicalANDExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-LogicalANDExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_AND> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_AND
And, And,
/// The logical OR operator returns the value the first operand if it can be coerced into `true`; /// The logical OR operator returns the value the first operand if it can be coerced into `true`;
@ -559,9 +596,10 @@ pub enum LogOp {
/// Syntax: `x || y` /// Syntax: `x || y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-LogicalORExpression>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-LogicalORExpression)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_OR> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_OR
Or, Or,
} }
@ -646,9 +684,10 @@ impl Display for BinOp {
/// There are also compound assignment operators that are shorthand for the operations /// There are also compound assignment operators that are shorthand for the operations
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Assignment
#[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)] #[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub enum AssignOp { pub enum AssignOp {
@ -659,9 +698,10 @@ pub enum AssignOp {
/// The types of the two operands determine the behavior of the addition assignment operator. Addition or concatenation is possible. /// The types of the two operands determine the behavior of the addition assignment operator. Addition or concatenation is possible.
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Addition_assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Addition_assignment
Add, Add,
/// The subtraction assignment operator subtracts the value of the right operand from a variable and assigns the result to the variable. /// The subtraction assignment operator subtracts the value of the right operand from a variable and assigns the result to the variable.
@ -669,9 +709,10 @@ pub enum AssignOp {
/// Syntax: `x -= y` /// Syntax: `x -= y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation](mdn)
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Subtraction_assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Subtraction_assignment
Sub, Sub,
/// The multiplication assignment operator multiplies a variable by the value of the right operand and assigns the result to the variable. /// The multiplication assignment operator multiplies a variable by the value of the right operand and assigns the result to the variable.
@ -679,9 +720,10 @@ pub enum AssignOp {
/// Syntax: `x *= y` /// Syntax: `x *= y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Multiplication_assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Multiplication_assignment
Mul, Mul,
/// The division assignment operator divides a variable by the value of the right operand and assigns the result to the variable. /// The division assignment operator divides a variable by the value of the right operand and assigns the result to the variable.
@ -689,9 +731,10 @@ pub enum AssignOp {
/// Syntax: `x /= y` /// Syntax: `x /= y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Division_assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Division_assignment
Div, Div,
/// The remainder assignment operator divides a variable by the value of the right operand and assigns the remainder to the variable. /// The remainder assignment operator divides a variable by the value of the right operand and assigns the remainder to the variable.
@ -699,9 +742,10 @@ pub enum AssignOp {
/// Syntax: `x %= y` /// Syntax: `x %= y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Remainder_assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Remainder_assignment
Mod, Mod,
/// The exponentiation assignment operator raises the value of a variable to the power of the right operand. /// The exponentiation assignment operator raises the value of a variable to the power of the right operand.
@ -709,9 +753,10 @@ pub enum AssignOp {
/// Syntax: `x ** y` /// Syntax: `x ** y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Exponentiation_assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Exponentiation_assignment
Exp, Exp,
/// The bitwise AND assignment operator uses the binary representation of both operands, does a bitwise AND operation on /// The bitwise AND assignment operator uses the binary representation of both operands, does a bitwise AND operation on
@ -720,9 +765,10 @@ pub enum AssignOp {
/// Syntax: `x &= y` /// Syntax: `x &= y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Bitwise_AND_assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Bitwise_AND_assignment
And, And,
/// The bitwise OR assignment operator uses the binary representation of both operands, does a bitwise OR operation on /// The bitwise OR assignment operator uses the binary representation of both operands, does a bitwise OR operation on
@ -731,9 +777,10 @@ pub enum AssignOp {
/// Syntax: `x |= y` /// Syntax: `x |= y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Bitwise_OR_assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Bitwise_OR_assignment
Or, Or,
/// The bitwise XOR assignment operator uses the binary representation of both operands, does a bitwise XOR operation on /// The bitwise XOR assignment operator uses the binary representation of both operands, does a bitwise XOR operation on
@ -742,9 +789,10 @@ pub enum AssignOp {
/// Syntax: `x ^= y` /// Syntax: `x ^= y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Bitwise_XOR_assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Bitwise_XOR_assignment
Xor, Xor,
/// The left shift assignment operator moves the specified amount of bits to the left and assigns the result to the variable. /// The left shift assignment operator moves the specified amount of bits to the left and assigns the result to the variable.
@ -752,9 +800,10 @@ pub enum AssignOp {
/// Syntax: `x <<= y` /// Syntax: `x <<= y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Left_shift_assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Left_shift_assignment
Shl, Shl,
/// The right shift assignment operator moves the specified amount of bits to the right and assigns the result to the variable. /// The right shift assignment operator moves the specified amount of bits to the right and assigns the result to the variable.
@ -762,9 +811,10 @@ pub enum AssignOp {
/// Syntax: `x >>= y` /// Syntax: `x >>= y`
/// ///
/// More information: /// More information:
/// - ECMAScript reference: <https://tc39.es/ecma262/#prod-AssignmentOperator>. /// - [ECMAScript reference](https://tc39.es/ecma262/#prod-AssignmentOperator)
/// - MDN documentation: /// - [MDN documentation][mdn]
/// <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Right_shift_assignment> ///
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Right_shift_assignment
Shr, Shr,
// TODO: Add UShl (unsigned shift left). // TODO: Add UShl (unsigned shift left).
} }

Loading…
Cancel
Save