dump tree doesn't print by default

This commit is contained in:
leaf corcoran 2018-04-30 18:21:40 -07:00
parent 57e4f984cb
commit 61b825fa5a
4 changed files with 10 additions and 6 deletions

View File

@ -74,7 +74,7 @@ compile_file_text = function(text, opts)
end
if opts.show_parse_tree then
local dump = require("moonscript.dump")
dump.tree(tree)
print(dump.tree(tree))
return true
end
local compile_time
@ -84,7 +84,9 @@ compile_file_text = function(text, opts)
do
local mod = opts.transform_module
if mod then
tree = assert(require(mod)(tree))
local file = assert(loadfile(mod))
local fn = assert(file())
tree = assert(fn(tree))
end
end
local code, posmap_or_err, err_pos = compile.tree(tree)

View File

@ -78,14 +78,16 @@ compile_file_text = (text, opts={}) ->
if opts.show_parse_tree
dump = require "moonscript.dump"
dump.tree tree
print dump.tree tree
return true
compile_time = if opts.benchmark
gettime!
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

View File

@ -32,7 +32,7 @@ tree = function(block)
local _list_0 = block
for _index_0 = 1, #_list_0 do
local value = _list_0[_index_0]
print(flat_value(value))
flat_value(value)
end
end
return {

View File

@ -12,7 +12,7 @@ value = (op) ->
flat_value op
tree = (block) ->
print flat_value value for value in *block
flat_value value for value in *block
{ :value, :tree }