Skip to content

Commit 7d9eff6

Browse files
authored
Merge pull request #41 from ReconfigureIO/feature/untangle-gendecls
Include imports in decls/fix consts and vars
2 parents 1e38568 + 26a3591 commit 7d9eff6

File tree

13 files changed

+521
-463
lines changed

13 files changed

+521
-463
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*int8(biggie)

fixtures/expressions/ptrcast/ptr.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"type": "star",
3+
"target": {
4+
"type": "call",
5+
"kind": "expression",
6+
"function": {
7+
"value": {
8+
"value": "int8",
9+
"kind": "ident"
10+
},
11+
"type": "identifier",
12+
"kind": "expression"
13+
},
14+
"ellipsis": false,
15+
"arguments": [
16+
{
17+
"value": {
18+
"value": "biggie",
19+
"kind": "ident"
20+
},
21+
"type": "identifier",
22+
"kind": "expression"
23+
}
24+
]
25+
},
26+
"kind": "expression"
27+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]int(foo)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"type": "cast",
3+
"target": {
4+
"value": {
5+
"value": "foo",
6+
"kind": "ident"
7+
},
8+
"type": "identifier",
9+
"kind": "expression"
10+
},
11+
"kind": "expression",
12+
"coerced-to": {
13+
"type": "slice",
14+
"kind": "type",
15+
"element": {
16+
"value": {
17+
"value": "int",
18+
"kind": "ident"
19+
},
20+
"type": "identifier",
21+
"kind": "type"
22+
}
23+
}
24+
}

fixtures/packages/emptyfor/empty.json

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
11
{
2-
"all-comments": [],
3-
"comments": [],
4-
"declarations": [
5-
[
6-
{
7-
"body": [
8-
{
9-
"body": [],
10-
"condition": null,
11-
"init": {
12-
"kind": "statement",
13-
"type": "empty"
14-
},
15-
"kind": "statement",
16-
"post": {
17-
"kind": "statement",
18-
"type": "empty"
19-
},
20-
"type": "for"
21-
}
22-
],
23-
"comments": [],
24-
"kind": "decl",
25-
"name": {
26-
"kind": "ident",
27-
"value": "main"
28-
},
29-
"params": [],
30-
"results": null,
31-
"type": "function"
32-
}
33-
]
34-
],
35-
"imports": [],
36-
"kind": "file",
37-
"name": {
38-
"kind": "ident",
39-
"value": "main"
2+
"name": {
3+
"value": "main",
4+
"kind": "ident"
5+
},
6+
"kind": "file",
7+
"imports": [],
8+
"declarations": [
9+
{
10+
"type": "function",
11+
"results": null,
12+
"params": [],
13+
"name": {
14+
"value": "main",
15+
"kind": "ident"
16+
},
17+
"kind": "decl",
18+
"comments": [],
19+
"body": [
20+
{
21+
"type": "for",
22+
"post": {
23+
"type": "empty",
24+
"kind": "statement"
25+
},
26+
"kind": "statement",
27+
"init": {
28+
"type": "empty",
29+
"kind": "statement"
30+
},
31+
"condition": null,
32+
"body": []
33+
}
34+
]
4035
}
36+
],
37+
"comments": [],
38+
"all-comments": []
4139
}
Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,49 @@
11
{
2-
"all-comments": [],
3-
"comments": [],
4-
"declarations": [
5-
[
6-
{
7-
"body": [
8-
{
9-
"kind": "statement",
10-
"type": "expression",
11-
"value": {
12-
"arguments": [
13-
{
14-
"kind": "literal",
15-
"type": "STRING",
16-
"value": "\"Hello, world!\""
17-
}
18-
],
19-
"ellipsis": false,
20-
"function": {
21-
"kind": "expression",
22-
"type": "identifier",
23-
"value": {
24-
"kind": "ident",
25-
"value": "println"
26-
}
27-
},
28-
"kind": "expression",
29-
"type": "call"
30-
}
31-
}
32-
],
33-
"comments": [],
34-
"kind": "decl",
35-
"name": {
36-
"kind": "ident",
37-
"value": "main"
38-
},
39-
"params": [],
40-
"results": null,
41-
"type": "function"
42-
}
43-
]
44-
],
45-
"imports": [],
46-
"kind": "file",
47-
"name": {
48-
"kind": "ident",
49-
"value": "main"
2+
"name": {
3+
"value": "main",
4+
"kind": "ident"
5+
},
6+
"kind": "file",
7+
"imports": [],
8+
"declarations": [
9+
{
10+
"type": "function",
11+
"results": null,
12+
"params": [],
13+
"name": {
14+
"value": "main",
15+
"kind": "ident"
16+
},
17+
"kind": "decl",
18+
"comments": [],
19+
"body": [
20+
{
21+
"value": {
22+
"type": "call",
23+
"kind": "expression",
24+
"function": {
25+
"value": {
26+
"value": "println",
27+
"kind": "ident"
28+
},
29+
"type": "identifier",
30+
"kind": "expression"
31+
},
32+
"ellipsis": false,
33+
"arguments": [
34+
{
35+
"value": "\"Hello, world!\"",
36+
"type": "STRING",
37+
"kind": "literal"
38+
}
39+
]
40+
},
41+
"type": "expression",
42+
"kind": "statement"
43+
}
44+
]
5045
}
46+
],
47+
"comments": [],
48+
"all-comments": []
5149
}

0 commit comments

Comments
 (0)