Remove uses of getfenv to work around Lua/LuaJIT inconsistency, and as a step towards 5.2 compatibility (thanks mva, Zash)

Fri, 13 Jul 2012 17:14:22 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 13 Jul 2012 17:14:22 +0100
changeset 85
347ac1733354
parent 84
14f827efadf2
child 86
2322f7932064

Remove uses of getfenv to work around Lua/LuaJIT inconsistency, and as a step towards 5.2 compatibility (thanks mva, Zash)

minify/llex.lua file | annotate | diff | comparison | revisions
minify/lparser.lua file | annotate | diff | comparison | revisions
uglify/llex.lua file | annotate | diff | comparison | revisions
--- a/minify/llex.lua	Sat Sep 24 19:39:30 2011 +0100
+++ b/minify/llex.lua	Fri Jul 13 17:14:22 2012 +0100
@@ -352,4 +352,4 @@
   end--while outer
 end
 
-return base.getfenv()
+return _M
--- a/minify/lparser.lua	Sat Sep 24 19:39:30 2011 +0100
+++ b/minify/lparser.lua	Fri Jul 13 17:14:22 2012 +0100
@@ -28,7 +28,6 @@
 local base = _G
 local string = require "string"
 module "lparser"
-local _G = base.getfenv()
 
 --[[--------------------------------------------------------------------
 -- variable and data structure initialization
@@ -1206,7 +1205,7 @@
   local fn = stat_call[c]
   -- handles: if while do for repeat function local return break
   if fn then
-    _G[fn]()
+    _M[fn]()
     -- return or break must be last statement
     if c == "return" or c == "break" then return true end
   else
@@ -1292,4 +1291,4 @@
   ilocalinfo, ilocalrefs = {}, {}
 end
 
-return _G
+return _M
--- a/uglify/llex.lua	Sat Sep 24 19:39:30 2011 +0100
+++ b/uglify/llex.lua	Fri Jul 13 17:14:22 2012 +0100
@@ -352,4 +352,4 @@
   end--while outer
 end
 
-return base.getfenv()
+return _M

mercurial