diff --git a/boa/src/builtins/function/mod.rs b/boa/src/builtins/function/mod.rs index ae4575c1c6..5ad1ed724e 100644 --- a/boa/src/builtins/function/mod.rs +++ b/boa/src/builtins/function/mod.rs @@ -40,12 +40,16 @@ pub enum ConstructorKind { /// Defines how this references are interpreted within the formal parameters and code body of the function. /// /// Arrow functions don't define a `this` and thus are lexical, `function`s do define a this and thus are NonLexical -#[derive(Trace, Finalize, Debug, Clone)] +#[derive(Copy, Finalize, Debug, Clone)] pub enum ThisMode { Lexical, NonLexical, } +unsafe impl Trace for ThisMode { + unsafe_empty_trace!(); +} + /// FunctionBody is specific to this interpreter, it will either be Rust code or JavaScript code (AST Node) #[derive(Clone, Finalize)] pub enum FunctionBody { diff --git a/boa/src/environment/function_environment_record.rs b/boa/src/environment/function_environment_record.rs index 71dcd4faf6..dcd3dbee00 100644 --- a/boa/src/environment/function_environment_record.rs +++ b/boa/src/environment/function_environment_record.rs @@ -16,12 +16,12 @@ use crate::{ lexical_environment::{Environment, EnvironmentType}, }, }; -use gc::{Finalize, Trace}; +use gc::{unsafe_empty_trace, Finalize, Trace}; use rustc_hash::FxHashMap; /// Different binding status for `this`. /// Usually set on a function environment record -#[derive(Trace, Finalize, Debug, Clone)] +#[derive(Copy, Finalize, Debug, Clone)] pub enum BindingStatus { /// If the value is "lexical", this is an ArrowFunction and does not have a local this value. Lexical, @@ -31,6 +31,10 @@ pub enum BindingStatus { Uninitialized, } +unsafe impl Trace for BindingStatus { + unsafe_empty_trace!(); +} + /// #[derive(Debug, Trace, Finalize, Clone)] pub struct FunctionEnvironmentRecord { diff --git a/boa/src/syntax/ast/node/mod.rs b/boa/src/syntax/ast/node/mod.rs index ab177d6259..0e54628b55 100644 --- a/boa/src/syntax/ast/node/mod.rs +++ b/boa/src/syntax/ast/node/mod.rs @@ -41,7 +41,7 @@ pub use self::{ try_node::{Catch, Finally, Try}, }; use super::Const; -use gc::{Finalize, Trace}; +use gc::{unsafe_empty_trace, Finalize, Trace}; use std::{ cmp::Ordering, fmt::{self, Display}, @@ -428,7 +428,7 @@ impl PropertyDefinition { /// [spec]: https://tc39.es/ecma262/#prod-MethodDefinition /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -#[derive(Clone, Debug, PartialEq, Trace, Finalize)] +#[derive(Clone, Debug, PartialEq, Copy, Finalize)] pub enum MethodDefinitionKind { /// The `get` syntax binds an object property to a function that will be called when that property is looked up. /// @@ -472,3 +472,7 @@ pub enum MethodDefinitionKind { Ordinary, // TODO: support other method definition kinds, like `Generator`. } + +unsafe impl Trace for MethodDefinitionKind { + unsafe_empty_trace!(); +}