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

Flexible Instance Naming in Class Methods. #1471

Open
sboof911 opened this issue Aug 1, 2023 · 0 comments · May be fixed by #1479
Open

Flexible Instance Naming in Class Methods. #1471

sboof911 opened this issue Aug 1, 2023 · 0 comments · May be fixed by #1479

Comments

@sboof911
Copy link
Member

sboof911 commented Aug 1, 2023

Describe the bug

The methods of a class should accept any naming of the instance of the class rather than just self.

To Reproduce

Provide code to reproduce the behavior:

class Point:
    def __init__(test, x, y):
        test.x = x
        test.y = y

    def add(test, x, y):
        test.x += x
        test.y += y

    def sup(test, x, y):
        test.x -= x
        test.y -= y

Error details

Provide the generated code, or the error message:

|fatal [semantic]: sboof.py [9,8]| Undefined variable ('self')

Language

Semantic part.

Additional context

The modification should be in :

cls = self.get_variable('self')

it should check on the first argument of the method.

@sboof911 sboof911 linked a pull request Aug 7, 2023 that will close this issue
@sboof911 sboof911 self-assigned this Aug 9, 2023
@EmilyBourne EmilyBourne mentioned this issue Aug 10, 2023
37 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants