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

new feature: Keep line number #311

Open
wants to merge 4 commits into
base: master
from

Conversation

@buckle2000
Copy link

@buckle2000 buckle2000 commented Dec 9, 2016

Well, I would like to keep line numbere when compling. In this way, luajit can also display the correct line number in stacktrace.

buckle2000 added 2 commits Dec 9, 2016
@ThaisRobba
Copy link

@ThaisRobba ThaisRobba commented Aug 11, 2017

This feature is quite useful, I like it! 👍
I noticed that the help info for moonc is missing the necessary parameter for using this. Could you take a look @buckle2000 ? 😃

@leafo could you review this PR, please? I'm not sure if anything else is missing!

buckle2000 added 2 commits Aug 11, 2017
Add CLI arg for keep_line_number
@buckle2000
Copy link
Author

@buckle2000 buckle2000 commented Aug 11, 2017

I think I fixed it. I really don't have time for this now.

@svermeulen
Copy link

@svermeulen svermeulen commented Oct 14, 2018

Can confirm this works for me too, thanks @buckle2000

@svermeulen
Copy link

@svermeulen svermeulen commented Dec 24, 2018

I should mention that I also had to add an 'n' to the list of characters this line local opts, ind = alt_getopt.get_opts(arg, "lvhwt:o:pTXb", {

@buckle2000
Copy link
Author

@buckle2000 buckle2000 commented Dec 29, 2018

Wow, this pull request is really old. @leafo is there any change you will merge this?

@svermeulen
Copy link

@svermeulen svermeulen commented Mar 17, 2019

In case anyone else uses this, I should mention that I updated @buckle2000 's branch with the leafo/master and put it here:
https://github.com/svermeulen/moonscript/tree/keep_line_number

@wu4
Copy link

@wu4 wu4 commented Apr 1, 2019

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.

@svermeulen
Copy link

@svermeulen svermeulen commented Apr 1, 2019

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

@svermeulen svermeulen mentioned this pull request Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.