mirror of
https://github.com/leafo/moonscript.git
synced 2024-10-05 05:34:19 +00:00
fix opts passing to cmd.moonc
This commit is contained in:
parent
a79eb19f9e
commit
2d5dd107d4
@ -315,8 +315,13 @@ else
|
||||
end
|
||||
|
||||
local success, err = compile_and_write(fname, target, {
|
||||
print = opts.p
|
||||
print = opts.p,
|
||||
fname = fname,
|
||||
benchmark = opts.b,
|
||||
show_posmap = opts.X,
|
||||
show_parse_tree = opts.T,
|
||||
})
|
||||
|
||||
if not success then
|
||||
io.stderr:write(fname .. "\t" .. err .. "\n")
|
||||
os.exit(1)
|
||||
|
@ -55,7 +55,7 @@ do
|
||||
end
|
||||
end
|
||||
end
|
||||
compile_file_text = function(text, fname, opts)
|
||||
compile_file_text = function(text, opts)
|
||||
if opts == nil then
|
||||
opts = { }
|
||||
end
|
||||
@ -97,7 +97,7 @@ compile_file_text = function(text, fname, opts)
|
||||
end
|
||||
if opts.benchmark then
|
||||
print(table.concat({
|
||||
fname,
|
||||
opts.fname or "stdin",
|
||||
"Parse time \t" .. format_time(parse_time),
|
||||
"Compile time\t" .. format_time(compile_time),
|
||||
""
|
||||
|
@ -63,7 +63,7 @@ gettime = do
|
||||
-- compiles file to lua, returns lua code
|
||||
-- returns nil, error on error
|
||||
-- returns true if some option handled the output instead
|
||||
compile_file_text = (text, fname, opts={}) ->
|
||||
compile_file_text = (text, opts={}) ->
|
||||
parse = require "moonscript.parse"
|
||||
compile = require "moonscript.compile"
|
||||
|
||||
@ -100,7 +100,7 @@ compile_file_text = (text, fname, opts={}) ->
|
||||
|
||||
if opts.benchmark
|
||||
print table.concat {
|
||||
fname,
|
||||
opts.fname or "stdin",
|
||||
"Parse time \t" .. format_time(parse_time),
|
||||
"Compile time\t" .. format_time(compile_time),
|
||||
""
|
||||
|
@ -55,7 +55,7 @@ describe "moonc", ->
|
||||
assert.same {
|
||||
[[return print('hello')]]
|
||||
}, {
|
||||
moonc.compile_file_text "print'hello'", "test.moon"
|
||||
moonc.compile_file_text "print'hello'", fname: "test.moon"
|
||||
}
|
||||
|
||||
describe "stubbed lfs", ->
|
||||
|
Loading…
Reference in New Issue
Block a user