mathiasbynens / luamin

A Lua minifier written in JavaScript
https://mths.be/luamin
MIT License
217 stars 54 forks source link

self is renamed in function FooClass:method #30

Closed rjharmon closed 8 years ago

rjharmon commented 9 years ago

self is a special word in Lua and should be skipped, or 'local b=self'd, maybe.

attempt to index global 'b' (a nil value)
rjharmon commented 9 years ago
function Indicator:setSize(arg)
  self.size = arg
  self.lastSizeChange = tmr.now(); -- nodemcu "current time"
end
mathiasbynens commented 8 years ago

Do you still see this issue with luamin v1.0.0? It seems to work as expected for me:

$ luamin -v
v1.0.0

$ cat issue-30.lua
function Indicator:setSize(arg)
  self.size = arg
  self.lastSizeChange = tmr.now(); -- nodemcu "current time"
end

$ luamin -f issue-30.lua
function Indicator:setSize(a)self.size=a;self.lastSizeChange=tmr.now()end