Skip to content

Extract Evaluator and NameResolver out of checker #229

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

Closed
wants to merge 7 commits into from

Conversation

rbuckton
Copy link

To better support enum emit without relying on the type checker, this moves NameResolver and related functionality from the compiler package to the binder package, and extracts Evaluator and related functionality into a new evaluator package.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

I think this move makes a lot of sense.

(I second Jake's suggestion of moving IsNumericLiteralName to jsnum.)

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

Marking as needing changes at least until CI is rerun to pick up main.

@jakebailey jakebailey self-requested a review January 16, 2025 18:10
}
}

func (r *NameResolver) ResolveEntityName(name *ast.Node, meaning ast.SymbolFlags, ignoreErrors bool, dontResolveAlias bool, location *ast.Node) *ast.Symbol {
Copy link
Member

Choose a reason for hiding this comment

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

Just skimming this again; this is something that isn't present on the NameResolver in the old compiler; is there some difference here that makes this something that should move? I see it referenced in the constant evaluator, but the evaluator in the old compiler doesn't seem to require it.

(More or less, it seems like there's more moving than we previously had which I'm trying to understand)

Copy link
Author

Choose a reason for hiding this comment

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

As I mentioned in the PR description, I'm extracting related functionality that enum emit depends on from the checker, resolveEntityName is used by resolveEntity, which is critical to the constant evaluator. Rather than duplicate resolveEntity in the checker and the enum transform, I opted to extract resolveEntity out of checker and centralize it within the new ConstantEvaluator type.

I've opted to do that in this PR instead of the enum emit PR to make both PRs easier to reason over.

@rbuckton
Copy link
Author

rbuckton commented Feb 6, 2025

Closing in favor of the more limited NameResolver in #284

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.

3 participants