First implementation of constant propagation

Local constant variables initialized with compile-time constants
are optimized away from the code.
This commit is contained in:
Roberto Ierusalimschy
2019-07-12 11:38:42 -03:00
parent be8445d7e4
commit f6aab3ec1f
12 changed files with 249 additions and 119 deletions

View File

@@ -324,7 +324,7 @@ do
-- errors due to non-closable values
local function foo ()
local <toclose> x = 34
local <toclose> x = {}
end
local stat, msg = pcall(foo)
assert(not stat and string.find(msg, "variable 'x'"))