Skip to content

Commit

Permalink
hooks default to array
Browse files Browse the repository at this point in the history
  • Loading branch information
genintho committed Dec 4, 2024
1 parent 55ea8e5 commit 1c46c8d
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 63 deletions.
2 changes: 1 addition & 1 deletion src/ast/property.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const KIND = "property";
* @property {boolean} readonly
* @property {boolean} nullable
* @property {Identifier|Array<Identifier>|null} type
* @propert {PropertyHook[]|null} hooks
* @propert {PropertyHook[]} hooks
* @property {AttrGroup[]} attrGroups
*/
module.exports = Statement.extends(
Expand Down
4 changes: 2 additions & 2 deletions src/parser/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ module.exports = {
propName = propName(name);

let value = null;
let property_hooks = null;
let property_hooks = [];

this.expect([",", ";", "=", "{"]);

Expand Down Expand Up @@ -264,7 +264,7 @@ module.exports = {
this.next();
return hooks;
}
return null;
return [];
},

read_property_hook: function () {
Expand Down
2 changes: 1 addition & 1 deletion test/snapshot/__snapshots__/acid.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"loc": Location {
"end": Position {
Expand Down
8 changes: 4 additions & 4 deletions test/snapshot/__snapshots__/attributes.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ Program {
"kind": "attrgroup",
},
],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -420,7 +420,7 @@ Program {
"kind": "attrgroup",
},
],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -457,7 +457,7 @@ Program {
"kind": "attrgroup",
},
],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -2663,7 +2663,7 @@ Program {
"kind": "attrgroup",
},
],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down
18 changes: 9 additions & 9 deletions test/snapshot/__snapshots__/class.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -471,7 +471,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -522,7 +522,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -551,7 +551,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -613,7 +613,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -1213,7 +1213,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -1391,7 +1391,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand All @@ -1413,7 +1413,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -1792,7 +1792,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down
8 changes: 4 additions & 4 deletions test/snapshot/__snapshots__/classpropertyhooks.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -492,7 +492,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -1546,7 +1546,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -1775,7 +1775,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down
6 changes: 3 additions & 3 deletions test/snapshot/__snapshots__/comment.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand All @@ -1879,7 +1879,7 @@ Program {
},
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -1914,7 +1914,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down
10 changes: 5 additions & 5 deletions test/snapshot/__snapshots__/graceful.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -339,7 +339,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand All @@ -365,7 +365,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down Expand Up @@ -933,7 +933,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand All @@ -959,7 +959,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down
2 changes: 1 addition & 1 deletion test/snapshot/__snapshots__/heredoc.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,7 @@ FOOBAR",
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down
4 changes: 2 additions & 2 deletions test/snapshot/__snapshots__/namespace.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"loc": Location {
"end": Position {
Expand Down Expand Up @@ -727,7 +727,7 @@ Program {
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"loc": Location {
"end": Position {
Expand Down
2 changes: 1 addition & 1 deletion test/snapshot/__snapshots__/nowdoc.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ FOOBAR",
"properties": [
Property {
"attrGroups": [],
"hooks": null,
"hooks": [],
"kind": "property",
"name": Identifier {
"kind": "identifier",
Expand Down
Loading

0 comments on commit 1c46c8d

Please sign in to comment.