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

Update parser to allow for inline conditional returns #12

Open
2 tasks
alexdovzhanyn opened this issue Jul 25, 2024 · 0 comments
Open
2 tasks

Update parser to allow for inline conditional returns #12

alexdovzhanyn opened this issue Jul 25, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest A good issue to work on for Hacktoberfest help wanted Extra attention is needed

Comments

@alexdovzhanyn
Copy link
Collaborator

alexdovzhanyn commented Jul 25, 2024

Currently if you try to write a conditional such as:

if (someCondition) return 'hello'

the compiler will throw a ParseError because it expects to find a block or an expression after the condition, but return is currently not being treated as an "expression". Let's change the parsing for conditional nodes, to allow for returns.

  • Update the parser to make returns work as the expression (for if, else if, and else)
  • Write a test to validate that the return keyword works in a single-line conditional with no curly braces
@alexdovzhanyn alexdovzhanyn added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jul 25, 2024
@alexdovzhanyn alexdovzhanyn changed the title Update parser to allow for inline conditionals Update parser to allow for inline conditional returns Jul 28, 2024
@alexdovzhanyn alexdovzhanyn added the hacktoberfest A good issue to work on for Hacktoberfest label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest A good issue to work on for Hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant