Skip to content

Commit f78982b

Browse files
authored
Merge pull request #3551 from bluesign/npm-parser
Fix Cadence Parser NPM Package
2 parents d947a94 + bcd5ff6 commit f78982b

File tree

2 files changed

+26
-60
lines changed

2 files changed

+26
-60
lines changed

npm-packages/cadence-parser/src/go.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class Go {
190190

191191
const timeOrigin = Date.now() - performance.now();
192192
this.importObject = {
193-
go: {
193+
gojs: {
194194
// Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)
195195
// may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported
196196
// function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).

npm-packages/cadence-parser/tests/index.test.ts

+25-59
Original file line numberDiff line numberDiff line change
@@ -4,117 +4,83 @@ import * as fs from "fs"
44
test("parse simple", async () => {
55
const binary = fs.readFileSync(require.resolve('../dist/cadence-parser.wasm'))
66
const parser = await CadenceParser.create(binary)
7-
const res = parser.parse("pub fun main() {}")
7+
const res = parser.parse("access(all) fun main() {}")
88
expect(res).toEqual({
99
"program": {
1010
"Type": "Program",
1111
"Declarations": [
1212
{
13-
"Access": "AccessPublic",
13+
"Access": "AccessAll",
1414
"DocString": "",
1515
"EndPos": {
16-
"Column": 16,
16+
"Column": 24,
1717
"Line": 1,
18-
"Offset": 16,
18+
"Offset": 24,
1919
},
2020
"FunctionBlock": {
2121
"Block": {
2222
"EndPos": {
23-
"Column": 16,
23+
"Column": 24,
2424
"Line": 1,
25-
"Offset": 16,
25+
"Offset": 24,
2626
},
2727
"StartPos": {
28-
"Column": 15,
28+
"Column": 23,
2929
"Line": 1,
30-
"Offset": 15,
30+
"Offset": 23,
3131
},
3232
"Statements": null,
3333
"Type": "Block",
3434
},
3535
"EndPos": {
36-
"Column": 16,
36+
"Column": 24,
3737
"Line": 1,
38-
"Offset": 16,
38+
"Offset": 24,
3939
},
4040
"StartPos": {
41-
"Column": 15,
41+
"Column": 23,
4242
"Line": 1,
43-
"Offset": 15,
43+
"Offset": 23,
4444
},
4545
"Type": "FunctionBlock",
4646
},
4747
"Identifier": {
4848
"EndPos": {
49-
"Column": 11,
49+
"Column": 19,
5050
"Line": 1,
51-
"Offset": 11,
51+
"Offset": 19,
5252
},
5353
"Identifier": "main",
5454
"StartPos": {
55-
"Column": 8,
55+
"Column": 16,
5656
"Line": 1,
57-
"Offset": 8,
57+
"Offset": 16,
5858
},
5959
},
60+
"IsNative": false,
61+
"IsStatic": false,
6062
"ParameterList": {
6163
"EndPos": {
62-
"Column": 13,
64+
"Column": 21,
6365
"Line": 1,
64-
"Offset": 13,
66+
"Offset": 21,
6567
},
6668
"Parameters": null,
6769
"StartPos": {
68-
"Column": 12,
69-
"Line": 1,
70-
"Offset": 12,
71-
},
72-
},
73-
"ReturnTypeAnnotation": {
74-
"AnnotatedType": {
75-
"EndPos": {
76-
"Column": 12,
77-
"Line": 1,
78-
"Offset": 12,
79-
},
80-
"Identifier": {
81-
"EndPos": {
82-
"Column": 12,
83-
"Line": 1,
84-
"Offset": 12,
85-
},
86-
"Identifier": "",
87-
"StartPos": {
88-
"Column": 13,
89-
"Line": 1,
90-
"Offset": 13,
91-
},
92-
},
93-
"StartPos": {
94-
"Column": 13,
95-
"Line": 1,
96-
"Offset": 13,
97-
},
98-
"Type": "NominalType",
99-
},
100-
"EndPos": {
101-
"Column": 12,
102-
"Line": 1,
103-
"Offset": 12,
104-
},
105-
"IsResource": false,
106-
"StartPos": {
107-
"Column": 13,
70+
"Column": 20,
10871
"Line": 1,
109-
"Offset": 13,
72+
"Offset": 20,
11073
},
11174
},
75+
"Purity": "Unspecified",
76+
"ReturnTypeAnnotation": null,
11277
"StartPos": {
11378
"Column": 0,
11479
"Line": 1,
11580
"Offset": 0,
11681
},
11782
"Type": "FunctionDeclaration",
83+
"TypeParameterList": null,
11884
},
11985
],
12086
},

0 commit comments

Comments
 (0)