Skip to content

Commit 85a853e

Browse files
wrapper.ts: some QA updates.
1 parent abaaa95 commit 85a853e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

wrapper.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function setupMethods (soljson) {
7070
};
7171
}
7272

73-
const wrappedLspStart = soljson.cwrap('solidity_lsp_start', 'number', []);
73+
const wrappedLspStart = soljson.cwrap('solidity_lsp_start', 'number', ['number']);
7474

7575
return function (callbacks: Callbacks) {
7676
const readCallback = callbacks.import;
@@ -79,6 +79,8 @@ function setupMethods (soljson) {
7979
const copyFromCString = soljson.UTF8ToString || soljson.Pointer_stringify;
8080

8181
const wrappedReadCallback = function (path: string, contents: string, error: string) {
82+
console.log("wrappedReadCallback: \"" + path + "\"");
83+
8284
// Calls the user-supplied file read callback and passes the return values
8385
// accordingly to either @p contents or into @p error on failure.
8486
const result = readCallback(copyFromCString(path));
@@ -94,15 +96,15 @@ function setupMethods (soljson) {
9496

9597
const addFunction = soljson.addFunction || soljson.Runtime.addFunction;
9698
const removeFunction = soljson.removeFunction || soljson.Runtime.removeFunction;
97-
const wrappedFunctionId = addFunction(wrappedReadCallback, 'ii');
99+
const wrappedReadCallbackId = addFunction(wrappedReadCallback, 'ii');
98100

99101
try {
100102
// call solidity_lsp_start(callbacks)
101-
const output = wrappedLspStart(wrappedFunctionId);
102-
removeFunction(wrappedFunctionId);
103+
const output = wrappedLspStart(wrappedReadCallbackId);
104+
removeFunction(wrappedReadCallbackId);
103105
return output;
104106
} catch (e) {
105-
removeFunction(wrappedFunctionId);
107+
removeFunction(wrappedReadCallbackId);
106108
throw e;
107109
}
108110

0 commit comments

Comments
 (0)