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

Add struct instantiation shortcut syntax #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fcoury
Copy link
Owner

@fcoury fcoury commented Jul 23, 2024

Add support for struct instantiation shortcut syntax.

  • Parser Changes:

    • Update parse_struct_init function in src/parser.rs to handle the new shortcut syntax for struct instantiation.
    • Modify parse_struct_init to check if the field name is the same as the variable name and handle accordingly.
  • Interpreter Changes:

    • Update evaluate_expr function in src/interpreter.rs to handle the new shortcut syntax for struct instantiation.
    • Modify evaluate_expr to check if the field name is the same as the variable name and handle accordingly.
  • Test Updates:

    • Update tests/scripts/struct.hk to use the new shortcut syntax for struct instantiation.
    • Update tests/scripts/impl.hk to use the new shortcut syntax for struct instantiation.

For more details, open the Copilot Workspace session.

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.

1 participant