Skip to content

compiler: break functions related to Decls out of Compile(). #1311

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

Merged
merged 1 commit into from
May 28, 2024

Conversation

nevkontakte
Copy link
Member

Further ports from the original generics branch, to facilitate refactorings I'll need to finish generics support.

For each package-level entity we emit one or more Decl struct, which contains all JS code fragments and metadata required to produce the final executable script.

For each decl type (imports, vars, functions and types) I created a separate function that contains the logic responsible for its creation (and some auxiliary functions). The main objective is to keep the Compile() function very high-level and clearly reflecting various compilation stages we go through.

I tried to add comments to make the code more accessible for future contributors (and future self...), although there are still some aspects I don't fully grasp.

Ideally, we would have tests for all these new functions, but that's way more work than I'm able to take on right now.

(based on commit 146735d)

Updates #1013

For each package-level entity we emit one or more Decl struct, which
contains all JS code fragments and metadata required to produce the
final executable script.

For each decl type (imports, vars, functions and types) I created a
separate function that contains the logic responsible for its creation
(and some auxiliary functions). The main objective is to keep the
Compile() function very high-level and clearly reflecting various
compilation stages we go through.

I tried to add comments to make the code more accessible for future
contributors (and future self...), although there are still some aspects
I don't fully grasp.

Ideally, we would have tests for all these new functions, but that's way
more work than I'm able to take on right now.

(based on commit 146735d)
@nevkontakte nevkontakte requested a review from flimzy May 25, 2024 21:39
@nevkontakte nevkontakte merged commit cfa0783 into gopherjs:master May 28, 2024
7 checks passed
@nevkontakte nevkontakte deleted the gng5 branch May 28, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants