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

State variable initialized to a function argument generates bad code #128

Open
snoopyjc opened this issue Feb 26, 2022 · 1 comment
Open

Comments

@snoopyjc
Copy link

snoopyjc commented Feb 26, 2022

State variable initialized to a function argument, my var, or expression generates bad code. For example:

sub banner {
    state $my_log_dir=$_[0];
    ...
}

Generates:

banner_my_log_dir = _args[0]

While this code looks perfectly reasonable, it's generated BELOW the function definition, where the arguments are no longer available. Same issue if the state var is initialized with a 'my' var of the function. If the state var is initialized with an expression, the code doesn't even try to make it a state var.

@snoopyjc
Copy link
Author

Fixed in my v0.959 https://github.com/snoopyjc/pythonizer/

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

No branches or pull requests

1 participant