Skip to content

Commit d036cf5

Browse files
authored
fix(estree): Ensure the same key order for AssignmentPattern (#10953)
Part of #9705 With this PR, all AST nodes now have a consistent key order for each node type. (Checked by https://github.com/leaysgur/oxc_estree_ts-ast-diff-viewer/blob/main/scripts/verify-key-order-oxc.js) Except for: - `Literal`: `regex` and `bigint` keys - `TSModuleDeclaration`: `body` key is missing when `declare module "jq";`
1 parent 08f1f3f commit d036cf5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

crates/oxc_ast/src/serialize.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,9 @@ impl ESTree for ArrowFunctionExpressionBody<'_> {
861861
left: keyCopy,
862862
right: init,
863863
/* IF_TS */
864-
typeAnnotation: null,
865-
optional: false,
866864
decorators: [],
865+
optional: false,
866+
typeAnnotation: null,
867867
/* END_IF_TS */
868868
};
869869
value
@@ -882,9 +882,9 @@ impl ESTree for AssignmentTargetPropertyIdentifierValue<'_> {
882882
state.serialize_field("end", &self.0.span.end);
883883
state.serialize_field("left", &self.0.binding);
884884
state.serialize_field("right", init);
885-
state.serialize_ts_field("typeAnnotation", &Null(()));
886-
state.serialize_ts_field("optional", &False(()));
887885
state.serialize_ts_field("decorators", &EmptyArray(()));
886+
state.serialize_ts_field("optional", &False(()));
887+
state.serialize_ts_field("typeAnnotation", &Null(()));
888888
state.end();
889889
} else {
890890
self.0.binding.serialize(serializer);

napi/parser/generated/deserialize/ts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,9 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) {
426426
end: end,
427427
left: keyCopy,
428428
right: init,
429-
typeAnnotation: null,
430-
optional: false,
431429
decorators: [],
430+
optional: false,
431+
typeAnnotation: null,
432432
};
433433
return {
434434
type: 'Property',

0 commit comments

Comments
 (0)