diff --git a/package.json b/package.json index 88f10dd..a4f3416 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@orbs-network/ton-access": "^2.3.3", "@tact-lang/compiler": "^1.1.2", "@tanstack/react-query": "^4.13.0", - "@ton-community/contract-verifier-sdk": "1.3.1", + "@ton-community/contract-verifier-sdk": "1.3.2", "@ton-community/func-js": "^0.3.0", "@tonconnect/ui-react": "^1.0.0-beta.6", "bigint-buffer": "^1.1.5", @@ -35,6 +35,8 @@ "func-js-bin-0.4.2": "npm:@ton-community/func-js-bin@^0.4.2", "func-js-bin-0.4.3": "npm:@ton-community/func-js-bin@^0.4.3", "func-js-bin-0.4.4": "npm:@ton-community/func-js-bin@^0.4.4", + "func-js-bin-0.5.0": "npm:@ton-community/func-js-bin@^0.5.0", + "highlight.js": "^11.6.0", "immer": "^9.0.17", "javascript-time-ago": "^2.5.7", "jszip": "^3.10.1", diff --git a/public/tree-sitter-func.wasm b/public/tree-sitter-func.wasm index 71370de..c00f6bb 100755 Binary files a/public/tree-sitter-func.wasm and b/public/tree-sitter-func.wasm differ diff --git a/src/lib/getter/getterParser.ts b/src/lib/getter/getterParser.ts index 34d6f03..241e2f5 100644 --- a/src/lib/getter/getterParser.ts +++ b/src/lib/getter/getterParser.ts @@ -48,29 +48,28 @@ export async function parseGetters(code: string): Promise { const getters = parsed.rootNode.children.filter( (c) => - c.type === "function_definition" && - c.children.find((n) => n.type === "specifiers_list")?.text.includes("method_id"), + c.type === "function_definition" && ( + // v0.4.x: `method_id` specifier + c.children.find((n) => n.type === "specifiers_list")?.text.includes("method_id") || + // since v0.5.0: `get` on the left + c.children.find((n) => n.type === "pre_specifiers_list")?.text.includes("get") + ), ); - const gettersParsed = getters.map((f) => { - const returnTypes = f.children[0].children - .filter((c) => !c.type.match(/[,()]/)) // TODO types are slice, primitive_type, ",", "(", ")" - .map((c) => c.text); - - const name = f.children.find((n) => n.type === "function_name")!.text; - - const parameters = f.children - .find((n) => n.type === "parameter_list")! - .children.filter((c) => c.type === "parameter_declaration") - .map((c) => ({ - type: c.child(0)!.text, - name: c.child(1)!.text, - })); - + const gettersParsed = getters.map((f: Parser.SyntaxNode) => { return { - returnTypes, - name, - parameters, + returnTypes: f + .childForFieldName("return_type")! + .children.filter((c) => !c.type.match(/[,()]/)) // TODO types are slice, primitive_type, ",", "(", ")" + .map((c) => c.text), + name: f.childForFieldName("name")!.text, + parameters: f + .childForFieldName("arguments")! + .children.filter((c) => c.type === "parameter_declaration") + .map((c) => ({ + type: c.child(0)!.text, + name: c.child(1)!.text, + })), }; });