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

Class declaration after local ^ causes a MoonScript.lua error #287

Closed
evaera opened this issue Sep 1, 2016 · 1 comment
Closed

Class declaration after local ^ causes a MoonScript.lua error #287

evaera opened this issue Sep 1, 2016 · 1 comment

Comments

@evaera
Copy link

evaera commented Sep 1, 2016

Forgive me if I'm just using this incorrectly, but whenever I try to use the local ^ syntax followed by a class declaration, I get the below error.

Compile error: [string "moonscript.lua"]:562: attempt to index field '?' (a nil value)
stack traceback:
    [string "moonscript.lua"]:562: in function 'transformer'
    [string "moonscript.lua"]:309: in function <[string "moonscript.lua"]:300>
    (tail call): ?
    [string "moonscript.lua"]:4858: in function 'stm'
    [string "moonscript.lua"]:4897: in function <[string "moonscript.lua"]:4888>
    (tail call): ?
    (tail call): ?

This is an example of the code that causes the error for me:

local ^

lowercase = 5
Uppercase = 3

class MyClass
    new: =>
        print 'hi'

Moving the class declaration before the line with local ^ fixes the issue, and local * also works. It doesn't seem to matter if the class name is uppercase, or if the class has a name at all, e.g. the code below still errors:

local ^
lowercase = 5
Uppercase = 5
class

Using version 0.4.0. thanks (:

@leafo leafo closed this as completed in bf437b2 Sep 25, 2016
@leafo
Copy link
Owner

leafo commented Sep 25, 2016

thanks for the report, fix will go out with next release

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