Skip to content

Commit

Permalink
Remove unnecessary derives for opcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed Oct 31, 2022
1 parent fb79789 commit e610305
Show file tree
Hide file tree
Showing 63 changed files with 146 additions and 142 deletions.
6 changes: 5 additions & 1 deletion boa_engine/src/bytecompiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2254,7 +2254,11 @@ impl<'b> ByteCompiler<'b> {
Statement::Labelled(labelled) => match labelled.item() {
LabelledItem::Statement(stmt) => match stmt {
Statement::ForLoop(for_loop) => {
self.compile_for_loop(for_loop, Some(labelled.label()), configurable_globals)?;
self.compile_for_loop(
for_loop,
Some(labelled.label()),
configurable_globals,
)?;
}
Statement::ForInLoop(for_in_loop) => {
self.compile_for_in_loop(
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/vm/opcode/await_stm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
///
/// Operation:
/// - Stops the current Async function and schedules it to resume later.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct Await;

impl Operation for Await {
Expand Down
6 changes: 3 additions & 3 deletions boa_engine/src/vm/opcode/binary_ops/logical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
///
/// Operation:
/// - Binary logical `&&` operation
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct LogicalAnd;

impl Operation for LogicalAnd {
Expand All @@ -29,7 +29,7 @@ impl Operation for LogicalAnd {
///
/// Operation:
/// - Binary logical `||` operation
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct LogicalOr;

impl Operation for LogicalOr {
Expand All @@ -51,7 +51,7 @@ impl Operation for LogicalOr {
///
/// Operation:
/// - Binary logical `||` operation
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct Coalesce;

impl Operation for Coalesce {
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/vm/opcode/binary_ops/macro_defined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ macro_rules! implement_bin_ops {
#[doc= "\n"]
#[doc="Operation:\n"]
#[doc= concat!(" - ", $doc_string)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct $name;

impl Operation for $name {
Expand Down
10 changes: 5 additions & 5 deletions boa_engine/src/vm/opcode/binary_ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) use macro_defined::*;
///
/// Operation:
/// - Binary `!=` operation
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct NotEq;

impl Operation for NotEq {
Expand All @@ -34,7 +34,7 @@ impl Operation for NotEq {
///
/// Operation:
/// - Binary `===` operation
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct StrictEq;

impl Operation for StrictEq {
Expand All @@ -53,7 +53,7 @@ impl Operation for StrictEq {
///
/// Operation:
/// - Binary `!==` operation
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct StrictNotEq;

impl Operation for StrictNotEq {
Expand All @@ -72,7 +72,7 @@ impl Operation for StrictNotEq {
///
/// Operation:
/// - Binary `in` operation
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct In;

impl Operation for In {
Expand Down Expand Up @@ -102,7 +102,7 @@ impl Operation for In {
///
/// Operation:
/// - Binary `instanceof` operation
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct InstanceOf;

impl Operation for InstanceOf {
Expand Down
8 changes: 4 additions & 4 deletions boa_engine/src/vm/opcode/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
///
/// Operation:
/// - Call a function named "eval".
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct CallEval;

impl Operation for CallEval {
Expand Down Expand Up @@ -65,7 +65,7 @@ impl Operation for CallEval {
///
/// Operation:
/// - Call a function named "eval" where the arguments contain spreads.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct CallEvalSpread;

impl Operation for CallEvalSpread {
Expand Down Expand Up @@ -127,7 +127,7 @@ impl Operation for CallEvalSpread {
///
/// Operation:
/// - Call a function
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct Call;

impl Operation for Call {
Expand Down Expand Up @@ -166,7 +166,7 @@ impl Operation for Call {
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct CallSpread;

impl Operation for CallSpread {
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/vm/opcode/concat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
///
/// Operation:
/// - Concat multiple stack objects into a string.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct ConcatToString;

impl Operation for ConcatToString {
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/vm/opcode/copy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
///
/// Operation:
/// - Copy all properties of one object to another object.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct CopyDataProperties;

impl Operation for CopyDataProperties {
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/vm/opcode/define/class/getter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
///
/// Operation:
/// - Defines a class getter by name.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DefineClassGetterByName;

impl Operation for DefineClassGetterByName {
Expand Down Expand Up @@ -56,7 +56,7 @@ impl Operation for DefineClassGetterByName {
///
/// Operation:
/// - Defines a class getter by value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DefineClassGetterByValue;

impl Operation for DefineClassGetterByValue {
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/vm/opcode/define/class/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
///
/// Operation:
/// - Defines a class method by name.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DefineClassMethodByName;

impl Operation for DefineClassMethodByName {
Expand Down Expand Up @@ -51,7 +51,7 @@ impl Operation for DefineClassMethodByName {
///
/// Operation:
/// - Defines a class method by value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DefineClassMethodByValue;

impl Operation for DefineClassMethodByValue {
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/vm/opcode/define/class/setter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
///
/// Operation:
/// - Defines a class setter by name.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DefineClassSetterByName;

impl Operation for DefineClassSetterByName {
Expand Down Expand Up @@ -56,7 +56,7 @@ impl Operation for DefineClassSetterByName {
///
/// Operation:
/// - Defines a class setter by value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DefineClassSetterByValue;

impl Operation for DefineClassSetterByValue {
Expand Down
8 changes: 4 additions & 4 deletions boa_engine/src/vm/opcode/define/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) use own_property::*;
///
/// Operation:
/// - Declare `var` type variable.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DefVar;

impl Operation for DefVar {
Expand Down Expand Up @@ -53,7 +53,7 @@ impl Operation for DefVar {
///
/// Operation:
/// - Declare and initialize a function argument.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DefInitVar;

impl Operation for DefInitVar {
Expand Down Expand Up @@ -88,7 +88,7 @@ impl Operation for DefInitVar {
///
/// Operation:
/// - Declare `let` type variable.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DefLet;

impl Operation for DefLet {
Expand All @@ -113,7 +113,7 @@ macro_rules! implement_declaritives {
#[doc= "\n"]
#[doc="Operation:\n"]
#[doc= concat!(" - ", $doc_string)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct $name;

impl Operation for $name {
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/vm/opcode/define/own_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
///
/// Operation:
/// - Defines a own property of an object by name.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DefineOwnPropertyByName;

impl Operation for DefineOwnPropertyByName {
Expand Down Expand Up @@ -47,7 +47,7 @@ impl Operation for DefineOwnPropertyByName {
///
/// Operation:
/// - Defines a own property of an object by value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DefineOwnPropertyByValue;

impl Operation for DefineOwnPropertyByValue {
Expand Down
8 changes: 4 additions & 4 deletions boa_engine/src/vm/opcode/delete/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
///
/// Operation:
/// - Deletes a property by name of an object
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DeletePropertyByName;

impl Operation for DeletePropertyByName {
Expand Down Expand Up @@ -39,7 +39,7 @@ impl Operation for DeletePropertyByName {
///
/// Operation:
/// - Deletes a property by value of an object
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DeletePropertyByValue;

impl Operation for DeletePropertyByValue {
Expand All @@ -66,7 +66,7 @@ impl Operation for DeletePropertyByValue {
///
/// Operation:
/// - Deletes a property by value of an object
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DeleteName;

impl Operation for DeleteName {
Expand Down Expand Up @@ -123,7 +123,7 @@ impl Operation for DeleteName {
///
/// Operation:
/// - Throws an error when trying to delete a property of `super`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct DeleteSuperThrow;

impl Operation for DeleteSuperThrow {
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/vm/opcode/dup/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
///
/// Operation:
/// - Push a copy of the top value on the stack.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct Dup;

impl Operation for Dup {
Expand Down
10 changes: 5 additions & 5 deletions boa_engine/src/vm/opcode/environment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
///
/// Operation:
/// - Pushes `this` value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct This;

impl Operation for This {
Expand All @@ -33,7 +33,7 @@ impl Operation for This {
///
/// Operation:
/// - Pushes the current `super` value to the stack.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct Super;

impl Operation for Super {
Expand Down Expand Up @@ -75,7 +75,7 @@ impl Operation for Super {
///
/// Operation:
/// - Execute the `super()` method.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct SuperCall;

impl Operation for SuperCall {
Expand Down Expand Up @@ -141,7 +141,7 @@ impl Operation for SuperCall {
///
/// Operation:
/// - Execute the `super()` method where the arguments contain spreads.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct SuperCallSpread;

impl Operation for SuperCallSpread {
Expand Down Expand Up @@ -212,7 +212,7 @@ impl Operation for SuperCallSpread {
///
/// Operation:
/// - Execute the `super()` method when no constructor of the class is defined.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct SuperCallDerived;

impl Operation for SuperCallDerived {
Expand Down
6 changes: 3 additions & 3 deletions boa_engine/src/vm/opcode/generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) use yield_stm::*;
///
/// Operation:
/// - Resumes the current generator function.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct GeneratorNext;

impl Operation for GeneratorNext {
Expand Down Expand Up @@ -62,7 +62,7 @@ impl Operation for GeneratorNext {
///
/// Operation:
/// - Resumes the current generator function.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct AsyncGeneratorNext;

impl Operation for AsyncGeneratorNext {
Expand Down Expand Up @@ -126,7 +126,7 @@ impl Operation for AsyncGeneratorNext {
///
/// Operation:
/// - Delegates the current generator function another generator.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct GeneratorNextDelegate;

impl Operation for GeneratorNextDelegate {
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/vm/opcode/generator/yield_stm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
///
/// Operation:
/// - Yield from the current execution.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct Yield;

impl Operation for Yield {
Expand Down
Loading

0 comments on commit e610305

Please sign in to comment.