-
Notifications
You must be signed in to change notification settings - Fork 5
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
Enhancement: support access specifiers for function block declarations #22
Enhancement: support access specifiers for function block declarations #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the help here! Overall, this is looking good. This is an important missing/mistaken piece in the current grammar.
There will be a few more things - if you're comfortable poking around, I'd be happy for your contributions. If not, we can merge and I can do a follow-up PR.
-
blark.transform.FunctionBlock
will require some changes since it's no longer just "ABSTRACT" which we support.- https://github.com/engineerjoe440/blark/blob/be1e969d2fdc830318f996c42022840f520458d1/blark/transform.py#L1791
- This will need to be switched to
Optional[MethodAccess]
- Annotations below will need to be updated as well
-
The transform classes support round-tripping of source code (modulo spacing information, since this is an abstract syntax tree and not a full syntax tree)
- So to that end, the
__str__
method will need updating to reflect the change in access. - Take a look at how the
Method
orProperty
ones work, since this is pretty similar. The short of it is that the_FlagHelper
base class takes care of creating the space-delimited strings. - https://github.com/engineerjoe440/blark/blob/be1e969d2fdc830318f996c42022840f520458d1/blark/transform.py#L1818
- So to that end, the
-
I'd like to get some more test coverage in
test_transform
to ensure the above are working sufficiently- The
test_parsing
suite is more tailored to "will the source be parsed without erroring out?" - smoke tests of sorts - The
test_transform
suite is "can it be parsed, transformed, and round-tripped back to source code?" - You'll see a lot more test parametrization and coverage there as opposed to the lackluster
test_parsing
- The
-
I'd be inclined to rename
MethodAccess
toAccessSpecifier
to be more general. It started out as just for methods, then I realized properties used the same, and now function blocks.
Thank you so much for your input and suggestions! I'm about to add some additional tests to Thank you again for your willingness to guide and share your work! |
98e28e5
to
7dc17cf
Compare
Thank you again for letting me muddle my way through this, and become familiar with your code-base. I really appreciate it! I think with this most recent set of commits, this PR should be ready for your review. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks great to me!
One last question about the vscode settings (above) and then I'll be happy to merge this in.
@@ -0,0 +1,4 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mostly a vim user, I'm not too familiar with how vscode settings are distributed with source packages. Is version-controlling settings.json
generally good practice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an excellent question!
In earnest, I think it's really at your discretion...
I like to keep the .vscode settings in the repo so that they'll be picked up across platforms and by any other developers using VSCode, that said, there's no inherent NEED for them, and could just as easily be lobbed into the .gitignore
file. I find it generally helpful to keep them around just like any other development tooling files (like ..gitignore
, or .pre-comit-config.yaml
, or anything else).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. I'm OK with leaving it in for now, at least.
Changes:
*.TcPOU
files.Closing Thoughts:
Please let me know if there are any questions or concerns with the changes! I have a few other enhancements I would like to contribute, and I want to make sure that my contributions are effective, and in-line with the direction you want to maintain.
Thank you so much!