mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
dump tree doesn't print by default
This commit is contained in:
parent
57e4f984cb
commit
61b825fa5a
@ -74,7 +74,7 @@ compile_file_text = function(text, opts)
|
|||||||
end
|
end
|
||||||
if opts.show_parse_tree then
|
if opts.show_parse_tree then
|
||||||
local dump = require("moonscript.dump")
|
local dump = require("moonscript.dump")
|
||||||
dump.tree(tree)
|
print(dump.tree(tree))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
local compile_time
|
local compile_time
|
||||||
@ -84,7 +84,9 @@ compile_file_text = function(text, opts)
|
|||||||
do
|
do
|
||||||
local mod = opts.transform_module
|
local mod = opts.transform_module
|
||||||
if mod then
|
if mod then
|
||||||
tree = assert(require(mod)(tree))
|
local file = assert(loadfile(mod))
|
||||||
|
local fn = assert(file())
|
||||||
|
tree = assert(fn(tree))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local code, posmap_or_err, err_pos = compile.tree(tree)
|
local code, posmap_or_err, err_pos = compile.tree(tree)
|
||||||
|
@ -78,14 +78,16 @@ compile_file_text = (text, opts={}) ->
|
|||||||
|
|
||||||
if opts.show_parse_tree
|
if opts.show_parse_tree
|
||||||
dump = require "moonscript.dump"
|
dump = require "moonscript.dump"
|
||||||
dump.tree tree
|
print dump.tree tree
|
||||||
return true
|
return true
|
||||||
|
|
||||||
compile_time = if opts.benchmark
|
compile_time = if opts.benchmark
|
||||||
gettime!
|
gettime!
|
||||||
|
|
||||||
if mod = opts.transform_module
|
if mod = opts.transform_module
|
||||||
tree = assert require(mod) tree
|
file = assert loadfile mod
|
||||||
|
fn = assert file!
|
||||||
|
tree = assert fn tree
|
||||||
|
|
||||||
code, posmap_or_err, err_pos = compile.tree tree
|
code, posmap_or_err, err_pos = compile.tree tree
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ tree = function(block)
|
|||||||
local _list_0 = block
|
local _list_0 = block
|
||||||
for _index_0 = 1, #_list_0 do
|
for _index_0 = 1, #_list_0 do
|
||||||
local value = _list_0[_index_0]
|
local value = _list_0[_index_0]
|
||||||
print(flat_value(value))
|
flat_value(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return {
|
return {
|
||||||
|
@ -12,7 +12,7 @@ value = (op) ->
|
|||||||
flat_value op
|
flat_value op
|
||||||
|
|
||||||
tree = (block) ->
|
tree = (block) ->
|
||||||
print flat_value value for value in *block
|
flat_value value for value in *block
|
||||||
|
|
||||||
{ :value, :tree }
|
{ :value, :tree }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user