Skip to content
This repository was archived by the owner on Mar 29, 2023. It is now read-only.

Commit d6886c4

Browse files
authored
Merge pull request glayzzle#241 from glayzzle/tests
tests: stuff
2 parents 0b4095c + b48898d commit d6886c4

37 files changed

+2759
-168
lines changed

src/ast.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ const Position = require("./ast/position");
2626
* - [TraitUse](#traituse)
2727
* - [TraitAlias](#traitalias)
2828
* - [TraitPrecedence](#traitprecedence)
29-
* - [Entry](#entry)
3029
* - [Comment](#comment)
3130
* - [CommentLine](#commentline)
3231
* - [CommentBlock](#commentblock)
3332
* - [Error](#error)
3433
* - [Expression](#expression)
34+
* - [Entry](#entry)
35+
* - [Closure](#closure)
3536
* - [Silent](#silent)
3637
* - [RetIf](#retif)
3738
* - [New](#new)
@@ -92,7 +93,6 @@ const Position = require("./ast/position");
9293
* - [Try](#try)
9394
* - [Catch](#catch)
9495
* - [Throw](#throw)
95-
* - [Closure](#closure)
9696
* - [UseGroup](#usegroup)
9797
* - [UseItem](#useitem)
9898
* - [Block](#block)

src/ast/closure.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
*/
66
"use strict";
77

8-
const Statement = require("./statement");
8+
const Expression = require("./expression");
99
const KIND = "closure";
1010

1111
/**
1212
* Defines a closure
1313
* @constructor Closure
14-
* @extends {Statement}
14+
* @extends {Expression}
1515
* @property {Parameter[]} arguments
1616
* @property {Variable[]} uses
1717
* @property {Identifier} type
@@ -20,7 +20,7 @@ const KIND = "closure";
2020
* @property {Block|null} body
2121
* @property {boolean} isStatic
2222
*/
23-
module.exports = Statement.extends(KIND, function Closure(
23+
module.exports = Expression.extends(KIND, function Closure(
2424
args,
2525
byref,
2626
uses,
@@ -30,7 +30,7 @@ module.exports = Statement.extends(KIND, function Closure(
3030
docs,
3131
location
3232
) {
33-
Statement.apply(this, [KIND, docs, location]);
33+
Expression.apply(this, [KIND, docs, location]);
3434
this.uses = uses;
3535
this.arguments = args;
3636
this.byref = byref;

src/ast/entry.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,23 @@
55
*/
66
"use strict";
77

8-
const Node = require("./node");
8+
const Expression = require("./expression");
99
const KIND = "entry";
1010

1111
/**
1212
* An array entry - see [Array](#array)
1313
* @constructor Entry
14-
* @extends {Node}
14+
* @extends {Expression}
1515
* @property {Node|null} key The entry key/offset
1616
* @property {Node} value The entry value
1717
*/
18-
module.exports = Node.extends(KIND, function Entry(key, value, docs, location) {
19-
Node.apply(this, [KIND, docs, location]);
18+
module.exports = Expression.extends(KIND, function Entry(
19+
key,
20+
value,
21+
docs,
22+
location
23+
) {
24+
Expression.apply(this, [KIND, docs, location]);
2025
this.key = key;
2126
this.value = value;
2227
});

test/snapshot/__snapshots__/array.test.js.snap

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,3 +450,37 @@ Program {
450450
"kind": "program",
451451
}
452452
`;
453+
454+
exports[`Array without keys single and empty (short form) 1`] = `
455+
Program {
456+
"children": Array [
457+
ExpressionStatement {
458+
"expression": Array {
459+
"items": Array [],
460+
"kind": "array",
461+
"shortForm": true,
462+
},
463+
"kind": "expressionstatement",
464+
},
465+
],
466+
"errors": Array [],
467+
"kind": "program",
468+
}
469+
`;
470+
471+
exports[`Array without keys single and empty 1`] = `
472+
Program {
473+
"children": Array [
474+
ExpressionStatement {
475+
"expression": Array {
476+
"items": Array [],
477+
"kind": "array",
478+
"shortForm": false,
479+
},
480+
"kind": "expressionstatement",
481+
},
482+
],
483+
"errors": Array [],
484+
"kind": "program",
485+
}
486+
`;

0 commit comments

Comments
 (0)