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

"undefined" can be the name of a parameter, too #383

Merged
merged 4 commits into from
Jan 29, 2024

Conversation

robrix
Copy link
Contributor

@robrix robrix commented Jan 29, 2024

When your function has a parameter named undefined, the parser makes it into an (undefined) node, distinct from all other parameters, and it doesn't get a covalue. This should probably be fixed in the parser, but in the interest of expedience (you'd be surprised/impressed/dismayed at how often this arises), we can work around the problem in the interim by just letting (undefined) sub in for a param—or, otherwise put: if it walks like a parameter, and it quacks like a parameter, it had better have a covalue like a parameter.

https://github.com/github/aleph/issues/3205

@robrix robrix requested a review from a team as a code owner January 29, 2024 16:11
@@ -2412,6 +2412,9 @@ inherit .return_or_yield

; the value of undefined is the undefined primitive
edge @undefined.value -> @undefined.builtins_undefined

; HACK: `undefined` is a perfectly cromulent name for a parameter, but the parser thinks it means this node instead. For the moment, work around the problem this causes by giving all `undefined` nodes covalues like parameters enjoy.
Copy link
Contributor

Choose a reason for hiding this comment

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

My only suggestion is add !!!! before the HACK to be in line with other similar comments. I try to use four exclamation points for things that we'll want to search for later, and then use a tag like "TODO" or "HACK" to distinguish what sort they are.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call 👍🏻

@robrix robrix merged commit fd6b357 into main Jan 29, 2024
7 checks passed
@robrix robrix deleted the what-are-keywords-anyway branch January 29, 2024 18:16
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