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

feat: support property defaults with constant and enum refs (#336) #600

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

Conversation

ahochsteger
Copy link
Contributor

@ahochsteger ahochsteger commented May 2, 2024

  • add helper functions getDeclarationValue() and getInitializerValue()
  • make user symbols available to sandbox evaluation
  • simplify initializer logic (eliminate ifs)

Please:

  • Make your pull request atomic, fixing one issue at a time unless there are many relevant issues that cannot be decoupled.
  • Provide a test case & update the documentation in the Readme.md

closes #336

…#336)

* add helper functions getDeclarationValue() and getInitializerValue()
* make user symbols available to sandbox evaluation
* simplify initializer logic (eliminate ifs)
@ahochsteger
Copy link
Contributor Author

@YousefED it would be great if you could give me some feedback, if I took the right way to implement this feature. AFAICS it should be a bit more generic, but I'm not sure, if there may be some edge cases that are still not handled properly and should generate a warning.
The main change is, that I had to put the values of the user symbols into the sandbox to resolve constant/enum references.
In addition there are helper two functions to derive the value of the declarations and initializers. Additional logic can be easily added by switching the supported kinds.
All tests (including the new one at test/programs/default-properties-ref) are running successfully.

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.

Can not generate default value for using enum in class
1 participant