Gwion / Gwion

:musical_note: strongly-timed musical programming language

Home Page:https://Gwion.github.io/Gwion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

find_template_match should be in its own file.

fennecdjay opened this issue · comments

Currently find_template_match is too big and takes a lot of space in src/parse/check.c
It would be better to move it to its own file (e.g: src/parse/func_resolve_tmpl.c` with its siblings (ensure_tmpl, check_template_args and probably a few other).
Bonus points for splitting the functions and maybe defining a struct to handle all this.

I'll like to work on this.

Please do! That's a great one.

Hey, I need some help. Will I need to create a new header file, which contains the definition of find_template_match, and include this file in check.c ? Or should I add the function to parse.h ? Or am I on the completely wrong track?

You're just fine, a new header (with guards e.g :#__ifndef __TEMPLATE_MATCH__ ... like the other headers) to include in src/parse/check.c is the way to go.

@Pranav2612000, I was busy yesterday, but I have more time to help now I you still need some 😄

Just say this message. Will submit a PR by the end of the day. I had a question. My understanding is that static functions can only be used inside the file they are defined in.If this is right, should I move all the static functions (called in func_resolve_tmpl.c) defined in check.c to the new file. Or should I make them non static so that they can be used outside the file too?

static functions can only be used inside the file they are defined in

That right. (I think 😄)
You should move them and keep them static. If they are also called in check.c, I guess it depends.

I'll move functions which I think are appropriate to the new file. And change some static functions to be non-static in check.c . You could then suggest changes in the PR. Is that 0kay?