Skip to content

Refactorings from the original generics branch #1291

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 4 commits into from
Apr 15, 2024

Conversation

nevkontakte
Copy link
Member

The original generics branch contains a lot of useful code cleanups and readability improvements that I'd like to carry over into the main branch. This PR contains a few of the simpler ones, with references to the original commits. Future PRs will bring some of the more complex changes.

Updates #1013.

  - Rename fc.Indent() → fc.Indented() for indenting code generated in a
    callback.
  - Add fc.Indentation() to generate the indentation sequence itself.

(cherry picked from commit f86fde6)
 - Document semantics of the `functionContext` fields (to the best of my
   knowledge, at least).
 - Move `signatureTypes` to the `typesutil.Signature` and add unit
   tests.
 - Make use of the `typesutil.Signature` helper type for more
   self-explanatory condition checks in the compiler code.

(based on commit 161d21d)
These functions provide mappings from Go entities (variables, types,
functions, etc.) to JS identifiers assigned to them. This commit adds
documentation comments and renames a couple of methods to better match
their role.

(based on commit 4767913)
This is the first step in reducing complexity of the compiler.Compile
function.

The new `sources` type represents all inputs into the package
compilation and simplifies extracting useful information out of them. It
is designed to have little business logic of its own and serves as a
convenient bridge to other packages like go/types or astrewrite.

The ErrorList type is extended with utility methods that reduce
verbosity of the calling code.

(cherry picked from commit cb5cf57)
@nevkontakte nevkontakte merged commit b5eb7ec into gopherjs:master Apr 15, 2024
7 checks passed
@nevkontakte nevkontakte deleted the gng4 branch April 15, 2024 21:45
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