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

compiler adds 'self' as argument to methods with @staticmethod annotation #15

Closed
scottstoller opened this issue Jun 18, 2018 · 1 comment

Comments

@scottstoller
Copy link

the DistAlgo compiler adds 'self' as an argument to methods annotated with @staticmethod it shouldn't.
scott

sadboy added a commit that referenced this issue Jun 24, 2018
Issue #15 (#15).

* da/compiler/dast.py(Process):
  - (.staticmethods): new field, keep track of all static methods defined in
    the process.
  - (.staticnames): new property, set of all static method names in the
    process.

* da/compiler/parser.py(Parser):
  - (.parse_decorators): check for `@staticmethod` decorators.
  - (.visit_ClassDef): update for changed signature of `parse_decorators`.
  - (.visit_FunctionDef): add static methods to `Process.staticmethods`;
    check that entry point and "setup" methods aren't declared static.

* da/compiler/pygen.py(PythonGenerator):
  - (.visit_Process): visit the `.staticmethods` field.
  - (.visit_Function): don't inject `self` argument for static methods.
  - (.visit_NamedVar): prepend process class name for references to static
    methods.
@sadboy
Copy link
Member

sadboy commented Jun 24, 2018

Hi Scott,
This should be fixed on master.
Thanks!

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

2 participants