From 484362ba283e745f05fe0cffb429023eae58bbfd Mon Sep 17 00:00:00 2001 From: Taras Boiko Date: Sun, 20 Mar 2022 16:07:56 +0200 Subject: [PATCH] Fixed dumping AST to Json not working Some of the fields in AST structs were both 1. Arrays 2. Marked as 'flatten' This is illegal per serde docs (and doesn't really make sense). The fix is to remove the attribute. See: https://serde.rs/attr-flatten.html Fixes: #1920 --- boa_engine/src/syntax/ast/node/array/mod.rs | 1 - boa_engine/src/syntax/ast/node/statement_list/mod.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/boa_engine/src/syntax/ast/node/array/mod.rs b/boa_engine/src/syntax/ast/node/array/mod.rs index 697913c594f..8a7cc09230e 100644 --- a/boa_engine/src/syntax/ast/node/array/mod.rs +++ b/boa_engine/src/syntax/ast/node/array/mod.rs @@ -29,7 +29,6 @@ mod tests; #[cfg_attr(feature = "deser", derive(Serialize, Deserialize))] #[derive(Clone, Debug, Trace, Finalize, PartialEq)] pub struct ArrayDecl { - #[cfg_attr(feature = "deser", serde(flatten))] arr: Box<[Node]>, has_trailing_comma_spread: bool, } diff --git a/boa_engine/src/syntax/ast/node/statement_list/mod.rs b/boa_engine/src/syntax/ast/node/statement_list/mod.rs index 0239b4548c4..57dcb770399 100644 --- a/boa_engine/src/syntax/ast/node/statement_list/mod.rs +++ b/boa_engine/src/syntax/ast/node/statement_list/mod.rs @@ -23,7 +23,6 @@ mod tests; #[cfg_attr(feature = "deser", derive(Serialize, Deserialize))] #[derive(Clone, Debug, Trace, Finalize, PartialEq)] pub struct StatementList { - #[cfg_attr(feature = "deser", serde(flatten))] items: Box<[Node]>, strict: bool, }