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

Commit 7337074

Browse files
authored
Merge pull request glayzzle#229 from glayzzle/fix-typereference
fix: typereference
2 parents bbf614e + 1c69545 commit 7337074

File tree

7 files changed

+1176
-113
lines changed

7 files changed

+1176
-113
lines changed

src/ast/typereference.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ TypeReference.types = [
3333
"object",
3434
"array",
3535
"callable",
36-
"iterable"
36+
"iterable",
37+
"void"
3738
];
3839

3940
module.exports = TypeReference;

test/snapshot/__snapshots__/parentreference.test.js.snap

Lines changed: 86 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,79 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`parentreference argument (uppercase) 1`] = `
4+
Program {
5+
"children": Array [
6+
_Function {
7+
"arguments": Array [
8+
Parameter {
9+
"byref": false,
10+
"kind": "parameter",
11+
"name": "arg",
12+
"nullable": false,
13+
"type": ParentReference {
14+
"kind": "parentreference",
15+
"raw": "PARENT",
16+
},
17+
"value": null,
18+
"variadic": false,
19+
},
20+
],
21+
"body": Block {
22+
"children": Array [],
23+
"kind": "block",
24+
},
25+
"byref": false,
26+
"kind": "function",
27+
"name": Identifier {
28+
"kind": "identifier",
29+
"name": "fn",
30+
},
31+
"nullable": false,
32+
"type": null,
33+
},
34+
],
35+
"errors": Array [],
36+
"kind": "program",
37+
}
38+
`;
39+
40+
exports[`parentreference argument 1`] = `
41+
Program {
42+
"children": Array [
43+
_Function {
44+
"arguments": Array [
45+
Parameter {
46+
"byref": false,
47+
"kind": "parameter",
48+
"name": "arg",
49+
"nullable": false,
50+
"type": ParentReference {
51+
"kind": "parentreference",
52+
"raw": "parent",
53+
},
54+
"value": null,
55+
"variadic": false,
56+
},
57+
],
58+
"body": Block {
59+
"children": Array [],
60+
"kind": "block",
61+
},
62+
"byref": false,
63+
"kind": "function",
64+
"name": Identifier {
65+
"kind": "identifier",
66+
"name": "fn",
67+
},
68+
"nullable": false,
69+
"type": null,
70+
},
71+
],
72+
"errors": Array [],
73+
"kind": "program",
74+
}
75+
`;
76+
377
exports[`parentreference call 1`] = `
478
Program {
579
"children": Array [
@@ -44,7 +118,7 @@ Program {
44118
}
45119
`;
46120

47-
exports[`parentreference parent (uppercase) 1`] = `
121+
exports[`parentreference return type declarations (uppercase) 1`] = `
48122
Program {
49123
"children": Array [
50124
_Function {
@@ -54,10 +128,7 @@ Program {
54128
"kind": "parameter",
55129
"name": "arg",
56130
"nullable": false,
57-
"type": ParentReference {
58-
"kind": "parentreference",
59-
"raw": "PARENT",
60-
},
131+
"type": null,
61132
"value": null,
62133
"variadic": false,
63134
},
@@ -73,15 +144,18 @@ Program {
73144
"name": "fn",
74145
},
75146
"nullable": false,
76-
"type": null,
147+
"type": ParentReference {
148+
"kind": "parentreference",
149+
"raw": "PARENT",
150+
},
77151
},
78152
],
79153
"errors": Array [],
80154
"kind": "program",
81155
}
82156
`;
83157

84-
exports[`parentreference parent 1`] = `
158+
exports[`parentreference return type declarations 1`] = `
85159
Program {
86160
"children": Array [
87161
_Function {
@@ -91,10 +165,7 @@ Program {
91165
"kind": "parameter",
92166
"name": "arg",
93167
"nullable": false,
94-
"type": ParentReference {
95-
"kind": "parentreference",
96-
"raw": "parent",
97-
},
168+
"type": null,
98169
"value": null,
99170
"variadic": false,
100171
},
@@ -110,7 +181,10 @@ Program {
110181
"name": "fn",
111182
},
112183
"nullable": false,
113-
"type": null,
184+
"type": ParentReference {
185+
"kind": "parentreference",
186+
"raw": "parent",
187+
},
114188
},
115189
],
116190
"errors": Array [],

test/snapshot/__snapshots__/selfreference.test.js.snap

Lines changed: 86 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,79 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`selfreference argument (uppercase) 1`] = `
4+
Program {
5+
"children": Array [
6+
_Function {
7+
"arguments": Array [
8+
Parameter {
9+
"byref": false,
10+
"kind": "parameter",
11+
"name": "arg",
12+
"nullable": false,
13+
"type": SelfReference {
14+
"kind": "selfreference",
15+
"raw": "SELF",
16+
},
17+
"value": null,
18+
"variadic": false,
19+
},
20+
],
21+
"body": Block {
22+
"children": Array [],
23+
"kind": "block",
24+
},
25+
"byref": false,
26+
"kind": "function",
27+
"name": Identifier {
28+
"kind": "identifier",
29+
"name": "fn",
30+
},
31+
"nullable": false,
32+
"type": null,
33+
},
34+
],
35+
"errors": Array [],
36+
"kind": "program",
37+
}
38+
`;
39+
40+
exports[`selfreference argument 1`] = `
41+
Program {
42+
"children": Array [
43+
_Function {
44+
"arguments": Array [
45+
Parameter {
46+
"byref": false,
47+
"kind": "parameter",
48+
"name": "arg",
49+
"nullable": false,
50+
"type": SelfReference {
51+
"kind": "selfreference",
52+
"raw": "self",
53+
},
54+
"value": null,
55+
"variadic": false,
56+
},
57+
],
58+
"body": Block {
59+
"children": Array [],
60+
"kind": "block",
61+
},
62+
"byref": false,
63+
"kind": "function",
64+
"name": Identifier {
65+
"kind": "identifier",
66+
"name": "fn",
67+
},
68+
"nullable": false,
69+
"type": null,
70+
},
71+
],
72+
"errors": Array [],
73+
"kind": "program",
74+
}
75+
`;
76+
377
exports[`selfreference call 1`] = `
478
Program {
579
"children": Array [
@@ -44,7 +118,7 @@ Program {
44118
}
45119
`;
46120

47-
exports[`selfreference parent (uppercase) 1`] = `
121+
exports[`selfreference return type declarations (uppercase) 1`] = `
48122
Program {
49123
"children": Array [
50124
_Function {
@@ -54,10 +128,7 @@ Program {
54128
"kind": "parameter",
55129
"name": "arg",
56130
"nullable": false,
57-
"type": SelfReference {
58-
"kind": "selfreference",
59-
"raw": "SELF",
60-
},
131+
"type": null,
61132
"value": null,
62133
"variadic": false,
63134
},
@@ -73,15 +144,18 @@ Program {
73144
"name": "fn",
74145
},
75146
"nullable": false,
76-
"type": null,
147+
"type": SelfReference {
148+
"kind": "selfreference",
149+
"raw": "SELF",
150+
},
77151
},
78152
],
79153
"errors": Array [],
80154
"kind": "program",
81155
}
82156
`;
83157

84-
exports[`selfreference parent 1`] = `
158+
exports[`selfreference return type declarations 1`] = `
85159
Program {
86160
"children": Array [
87161
_Function {
@@ -91,10 +165,7 @@ Program {
91165
"kind": "parameter",
92166
"name": "arg",
93167
"nullable": false,
94-
"type": SelfReference {
95-
"kind": "selfreference",
96-
"raw": "self",
97-
},
168+
"type": null,
98169
"value": null,
99170
"variadic": false,
100171
},
@@ -110,7 +181,10 @@ Program {
110181
"name": "fn",
111182
},
112183
"nullable": false,
113-
"type": null,
184+
"type": SelfReference {
185+
"kind": "selfreference",
186+
"raw": "self",
187+
},
114188
},
115189
],
116190
"errors": Array [],

0 commit comments

Comments
 (0)