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

Duplicate Usage of Labels in Closure #130

Open
Mercerenies opened this issue Dec 6, 2022 · 0 comments
Open

Duplicate Usage of Labels in Closure #130

Mercerenies opened this issue Dec 6, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Mercerenies
Copy link
Owner

(labels ((foo () (bar)) (bar () (foo)))
  (lambda () (foo) (bar)))

This produces a closure object that incorrectly uses the _locals name twice.

class _LambdaBlock extends GDLisp.Function:

    var _locals
    var _locals

    func _init(_locals, _locals):
        self._locals = _locals
        self._locals = _locals
        self.__gdlisp_required = 0
        self.__gdlisp_optional = 0
        self.__gdlisp_rest = 0

    func call_func():
        _locals._fn_foo_1()
        return _locals._fn_bar_0()

    func call_funcv(args):
        if args == null:
            return call_func()
        else:
            push_error("Too many arguments")

It's the same _locals object, so we only need it once. And this is a syntax error in GDScript right now.

@Mercerenies Mercerenies added the bug Something isn't working label Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant