Skip to content

Commit 1c46c8d

Browse files
committed
hooks default to array
1 parent 55ea8e5 commit 1c46c8d

13 files changed

+63
-63
lines changed

src/ast/property.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const KIND = "property";
1818
* @property {boolean} readonly
1919
* @property {boolean} nullable
2020
* @property {Identifier|Array<Identifier>|null} type
21-
* @propert {PropertyHook[]|null} hooks
21+
* @propert {PropertyHook[]} hooks
2222
* @property {AttrGroup[]} attrGroups
2323
*/
2424
module.exports = Statement.extends(

src/parser/class.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ module.exports = {
201201
propName = propName(name);
202202

203203
let value = null;
204-
let property_hooks = null;
204+
let property_hooks = [];
205205

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

@@ -264,7 +264,7 @@ module.exports = {
264264
this.next();
265265
return hooks;
266266
}
267-
return null;
267+
return [];
268268
},
269269

270270
read_property_hook: function () {

test/snapshot/__snapshots__/acid.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ Program {
854854
"properties": [
855855
Property {
856856
"attrGroups": [],
857-
"hooks": null,
857+
"hooks": [],
858858
"kind": "property",
859859
"loc": Location {
860860
"end": Position {

test/snapshot/__snapshots__/attributes.test.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ Program {
383383
"kind": "attrgroup",
384384
},
385385
],
386-
"hooks": null,
386+
"hooks": [],
387387
"kind": "property",
388388
"name": Identifier {
389389
"kind": "identifier",
@@ -420,7 +420,7 @@ Program {
420420
"kind": "attrgroup",
421421
},
422422
],
423-
"hooks": null,
423+
"hooks": [],
424424
"kind": "property",
425425
"name": Identifier {
426426
"kind": "identifier",
@@ -457,7 +457,7 @@ Program {
457457
"kind": "attrgroup",
458458
},
459459
],
460-
"hooks": null,
460+
"hooks": [],
461461
"kind": "property",
462462
"name": Identifier {
463463
"kind": "identifier",
@@ -2663,7 +2663,7 @@ Program {
26632663
"kind": "attrgroup",
26642664
},
26652665
],
2666-
"hooks": null,
2666+
"hooks": [],
26672667
"kind": "property",
26682668
"name": Identifier {
26692669
"kind": "identifier",

test/snapshot/__snapshots__/class.test.js.snap

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Program {
6868
"properties": [
6969
Property {
7070
"attrGroups": [],
71-
"hooks": null,
71+
"hooks": [],
7272
"kind": "property",
7373
"name": Identifier {
7474
"kind": "identifier",
@@ -471,7 +471,7 @@ Program {
471471
"properties": [
472472
Property {
473473
"attrGroups": [],
474-
"hooks": null,
474+
"hooks": [],
475475
"kind": "property",
476476
"name": Identifier {
477477
"kind": "identifier",
@@ -522,7 +522,7 @@ Program {
522522
"properties": [
523523
Property {
524524
"attrGroups": [],
525-
"hooks": null,
525+
"hooks": [],
526526
"kind": "property",
527527
"name": Identifier {
528528
"kind": "identifier",
@@ -551,7 +551,7 @@ Program {
551551
"properties": [
552552
Property {
553553
"attrGroups": [],
554-
"hooks": null,
554+
"hooks": [],
555555
"kind": "property",
556556
"name": Identifier {
557557
"kind": "identifier",
@@ -613,7 +613,7 @@ Program {
613613
"properties": [
614614
Property {
615615
"attrGroups": [],
616-
"hooks": null,
616+
"hooks": [],
617617
"kind": "property",
618618
"name": Identifier {
619619
"kind": "identifier",
@@ -1213,7 +1213,7 @@ Program {
12131213
"properties": [
12141214
Property {
12151215
"attrGroups": [],
1216-
"hooks": null,
1216+
"hooks": [],
12171217
"kind": "property",
12181218
"name": Identifier {
12191219
"kind": "identifier",
@@ -1391,7 +1391,7 @@ Program {
13911391
"properties": [
13921392
Property {
13931393
"attrGroups": [],
1394-
"hooks": null,
1394+
"hooks": [],
13951395
"kind": "property",
13961396
"name": Identifier {
13971397
"kind": "identifier",
@@ -1413,7 +1413,7 @@ Program {
14131413
"properties": [
14141414
Property {
14151415
"attrGroups": [],
1416-
"hooks": null,
1416+
"hooks": [],
14171417
"kind": "property",
14181418
"name": Identifier {
14191419
"kind": "identifier",
@@ -1792,7 +1792,7 @@ Program {
17921792
"properties": [
17931793
Property {
17941794
"attrGroups": [],
1795-
"hooks": null,
1795+
"hooks": [],
17961796
"kind": "property",
17971797
"name": Identifier {
17981798
"kind": "identifier",

test/snapshot/__snapshots__/classpropertyhooks.test.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ Program {
202202
"properties": [
203203
Property {
204204
"attrGroups": [],
205-
"hooks": null,
205+
"hooks": [],
206206
"kind": "property",
207207
"name": Identifier {
208208
"kind": "identifier",
@@ -492,7 +492,7 @@ Program {
492492
"properties": [
493493
Property {
494494
"attrGroups": [],
495-
"hooks": null,
495+
"hooks": [],
496496
"kind": "property",
497497
"name": Identifier {
498498
"kind": "identifier",
@@ -1546,7 +1546,7 @@ Program {
15461546
"properties": [
15471547
Property {
15481548
"attrGroups": [],
1549-
"hooks": null,
1549+
"hooks": [],
15501550
"kind": "property",
15511551
"name": Identifier {
15521552
"kind": "identifier",
@@ -1775,7 +1775,7 @@ Program {
17751775
"properties": [
17761776
Property {
17771777
"attrGroups": [],
1778-
"hooks": null,
1778+
"hooks": [],
17791779
"kind": "property",
17801780
"name": Identifier {
17811781
"kind": "identifier",

test/snapshot/__snapshots__/comment.test.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,7 @@ Program {
18661866
"properties": [
18671867
Property {
18681868
"attrGroups": [],
1869-
"hooks": null,
1869+
"hooks": [],
18701870
"kind": "property",
18711871
"name": Identifier {
18721872
"kind": "identifier",
@@ -1879,7 +1879,7 @@ Program {
18791879
},
18801880
Property {
18811881
"attrGroups": [],
1882-
"hooks": null,
1882+
"hooks": [],
18831883
"kind": "property",
18841884
"name": Identifier {
18851885
"kind": "identifier",
@@ -1914,7 +1914,7 @@ Program {
19141914
"properties": [
19151915
Property {
19161916
"attrGroups": [],
1917-
"hooks": null,
1917+
"hooks": [],
19181918
"kind": "property",
19191919
"name": Identifier {
19201920
"kind": "identifier",

test/snapshot/__snapshots__/graceful.test.js.snap

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Program {
1414
"properties": [
1515
Property {
1616
"attrGroups": [],
17-
"hooks": null,
17+
"hooks": [],
1818
"kind": "property",
1919
"name": Identifier {
2020
"kind": "identifier",
@@ -339,7 +339,7 @@ Program {
339339
"properties": [
340340
Property {
341341
"attrGroups": [],
342-
"hooks": null,
342+
"hooks": [],
343343
"kind": "property",
344344
"name": Identifier {
345345
"kind": "identifier",
@@ -365,7 +365,7 @@ Program {
365365
"properties": [
366366
Property {
367367
"attrGroups": [],
368-
"hooks": null,
368+
"hooks": [],
369369
"kind": "property",
370370
"name": Identifier {
371371
"kind": "identifier",
@@ -933,7 +933,7 @@ Program {
933933
"properties": [
934934
Property {
935935
"attrGroups": [],
936-
"hooks": null,
936+
"hooks": [],
937937
"kind": "property",
938938
"name": Identifier {
939939
"kind": "identifier",
@@ -959,7 +959,7 @@ Program {
959959
"properties": [
960960
Property {
961961
"attrGroups": [],
962-
"hooks": null,
962+
"hooks": [],
963963
"kind": "property",
964964
"name": Identifier {
965965
"kind": "identifier",

test/snapshot/__snapshots__/heredoc.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,7 @@ FOOBAR",
17231723
"properties": [
17241724
Property {
17251725
"attrGroups": [],
1726-
"hooks": null,
1726+
"hooks": [],
17271727
"kind": "property",
17281728
"name": Identifier {
17291729
"kind": "identifier",

test/snapshot/__snapshots__/namespace.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ Program {
187187
"properties": [
188188
Property {
189189
"attrGroups": [],
190-
"hooks": null,
190+
"hooks": [],
191191
"kind": "property",
192192
"loc": Location {
193193
"end": Position {
@@ -727,7 +727,7 @@ Program {
727727
"properties": [
728728
Property {
729729
"attrGroups": [],
730-
"hooks": null,
730+
"hooks": [],
731731
"kind": "property",
732732
"loc": Location {
733733
"end": Position {

0 commit comments

Comments
 (0)