Browse Source

Fix panic on AST dump in JSON format (#1959)

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

Co-authored-by: Taras Boiko <me@tboiko.com>
pull/1960/head
Taras Boiko 3 years ago
parent
commit
e73c3fd65a
  1. 1
      boa_engine/src/syntax/ast/node/array/mod.rs
  2. 1
      boa_engine/src/syntax/ast/node/statement_list/mod.rs

1
boa_engine/src/syntax/ast/node/array/mod.rs

@ -29,7 +29,6 @@ mod tests;
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))] #[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)] #[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct ArrayDecl { pub struct ArrayDecl {
#[cfg_attr(feature = "deser", serde(flatten))]
arr: Box<[Node]>, arr: Box<[Node]>,
has_trailing_comma_spread: bool, has_trailing_comma_spread: bool,
} }

1
boa_engine/src/syntax/ast/node/statement_list/mod.rs

@ -23,7 +23,6 @@ mod tests;
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))] #[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)] #[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct StatementList { pub struct StatementList {
#[cfg_attr(feature = "deser", serde(flatten))]
items: Box<[Node]>, items: Box<[Node]>,
strict: bool, strict: bool,
} }

Loading…
Cancel
Save