Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FunC v0.5.0 logic and dependencies updates #212

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason highlight.js wasn't included so far is because contract-verifier-sdk has it with it. just otherwise there may be a version discrepancy which is the downside with this approach.

"immer": "^9.0.17",
"javascript-time-ago": "^2.5.7",
"jszip": "^3.10.1",
Expand Down
Binary file modified public/tree-sitter-func.wasm
Binary file not shown.
39 changes: 19 additions & 20 deletions src/lib/getter/getterParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,28 @@ export async function parseGetters(code: string): Promise<Getter[]> {

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,
})),
};
});

Expand Down
Loading