-
Notifications
You must be signed in to change notification settings - Fork 191
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
new feature: Keep line number #311
base: master
Are you sure you want to change the base?
Conversation
This feature is quite useful, I like it! 👍 @leafo could you review this PR, please? I'm not sure if anything else is missing! |
Add CLI arg for keep_line_number
I think I fixed it. I really don't have time for this now. |
Can confirm this works for me too, thanks @buckle2000 |
I should mention that I also had to add an 'n' to the list of characters this line |
Wow, this pull request is really old. @leafo is there any change you will merge this? |
In case anyone else uses this, I should mention that I updated @buckle2000 's branch with the leafo/master and put it here: |
I was scratching my head trying to debug using this branch. Classes don't seem to work well with this concept, given Moonscript's implementation of them. Since the constructor is added in postfix, I don't think it's possible to get the Moonscript source lined up properly. Aside from that, classes seem to love to merge themselves into other lines: f1 = ->
"Hello world!"
class Test
new: (value) =>
@index = value
func: (var) =>
print var
class Test2
new: =>
print f1!
f2 = ->
var = "I'm a function!"
print var
becomes local f1 f1 = function()
return "Hello world!" end local Test do local _class_0 local _base_0 = { func = function(self, var)
return print(var) end } _base_0.__index = _base_0 _class_0 = setmetatable({ __init = function(self, value) self.index = value end, __base = _base_0, __name = "Test" }, { __index = _base_0, __call = function(cls, ...) local _self_0 = setmetatable({}, _base_0) cls.__init(_self_0, ...) return _self_0 end }) _base_0.__class = _class_0 Test = _class_0 end local Test2 do local _class_0 local _base_0 = { } _base_0.__index = _base_0 _class_0 = setmetatable({ __init = function(self)
return print(f1()) end, __base = _base_0, __name = "Test2" }, { __index = _base_0, __call = function(cls, ...) local _self_0 = setmetatable({}, _base_0) cls.__init(_self_0, ...) return _self_0 end }) _base_0.__class = _class_0 Test2 = _class_0 end
local f2 f2 = function()
local var = "I'm a function!"
return print(var) end I think this will require a lot more work than anticipated. |
Yeah, I've been using this for awhile and have noticed that it isn't perfect. It can often be off a couple lines. But for my purposes it's significantly better than having to search through the generated lua manually |
Well, I would like to keep line numbere when compling. In this way, luajit can also display the correct line number in stacktrace.