bug 443726: --print-src and --print-ast options do not work
diff --git a/bin/metalua b/bin/metalua
index 77e0b65..fe4a14b 100644
--- a/bin/metalua
+++ b/bin/metalua
@@ -184,6 +184,8 @@
-- into `+{ return (function(...) -{ast} end)(...) }`
local prv_ast = code[last_file_idx]
local new_ast = { tag='Return', prv_ast }
+ new_ast.source, new_ast.origin, prv_ast.source, prv_ast.origin =
+ prv_ast.source, prv_ast.origin, nil, nil
code[last_file_idx] = new_ast
end
@@ -202,7 +204,7 @@
local pp_cfg = cfg['print-ast-lineinfo']
and { line_max=1, fix_indent=1, metalua_tag=1 }
or { line_max=1, metalua_tag=1, hide_hash=1 }
- pp.print(x, 80, pp_cfg)
+ pp.print(x, pp_cfg)
end
end
@@ -211,9 +213,9 @@
if cfg['print-src'] then
verb_print "Resulting sources:"
for _, x in ipairs(code) do
- printf("--- Source From %s: ---", table.tostring(x.source, 'nohash'))
+ pp.printf("--- Source From %s: ---", pp.tostring(x.source, 'nohash'))
if x.origin and x.origin.tag=='File' then x=x[1][1][2] end
- print (compiler :ast2string (x))
+ print (compiler :ast_to_src(x))
end
end