mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
Merge pull request #133 from mpeterv/remove_unused_variables
Removed some unused variables
This commit is contained in:
commit
fb986e941c
@ -128,7 +128,6 @@ return {
|
||||
insert_loader = insert_loader,
|
||||
remove_loader = remove_loader,
|
||||
to_lua = to_lua,
|
||||
moon_chunk = moon_chunk,
|
||||
moon_loader = moon_loader,
|
||||
dirsep = dirsep,
|
||||
dofile = dofile,
|
||||
|
@ -102,7 +102,7 @@ remove_loader = ->
|
||||
|
||||
{
|
||||
_NAME: "moonscript"
|
||||
:insert_loader, :remove_loader, :to_lua, :moon_chunk, :moon_loader, :dirsep,
|
||||
:insert_loader, :remove_loader, :to_lua, :moon_loader, :dirsep,
|
||||
:dofile, :loadfile, :loadstring
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,6 @@ do
|
||||
end
|
||||
end
|
||||
insert(buffer, "\n")
|
||||
local last = l
|
||||
elseif Lines == _exp_0 then
|
||||
l:flatten(indent and indent .. indent_char or indent_char, buffer)
|
||||
else
|
||||
@ -696,7 +695,6 @@ tree = function(tree, options)
|
||||
if not (success) then
|
||||
local error_msg, error_pos
|
||||
if type(err) == "table" then
|
||||
local error_type = err[1]
|
||||
local _exp_0 = err[1]
|
||||
if "user-error" == _exp_0 or "compile-error" == _exp_0 then
|
||||
error_msg, error_pos = unpack(err, 2)
|
||||
|
@ -76,7 +76,6 @@ class Lines
|
||||
insert buffer, ";"
|
||||
|
||||
insert buffer, "\n"
|
||||
last = l
|
||||
when Lines
|
||||
l\flatten indent and indent .. indent_char or indent_char, buffer
|
||||
else
|
||||
@ -452,7 +451,6 @@ tree = (tree, options={}) ->
|
||||
|
||||
unless success
|
||||
error_msg, error_pos = if type(err) == "table"
|
||||
error_type = err[1]
|
||||
switch err[1]
|
||||
when "user-error", "compile-error"
|
||||
unpack err, 2
|
||||
|
@ -1,5 +1,4 @@
|
||||
local util = require("moonscript.util")
|
||||
local data = require("moonscript.data")
|
||||
local reversed, unpack
|
||||
reversed, unpack = util.reversed, util.unpack
|
||||
local ntype
|
||||
|
@ -1,6 +1,5 @@
|
||||
|
||||
util = require "moonscript.util"
|
||||
data = require "moonscript.data"
|
||||
|
||||
import reversed, unpack from util
|
||||
import ntype from require "moonscript.types"
|
||||
|
@ -10,7 +10,6 @@ local types = require"moonscript.types"
|
||||
|
||||
local ntype = types.ntype
|
||||
|
||||
local dump = util.dump
|
||||
local trim = util.trim
|
||||
|
||||
local getfenv = util.getfenv
|
||||
@ -126,7 +125,7 @@ end
|
||||
|
||||
local function extract_line(str, start_pos)
|
||||
str = str:sub(start_pos)
|
||||
m = str:match"^(.-)\n"
|
||||
local m = str:match"^(.-)\n"
|
||||
if m then return m end
|
||||
return str:match"^.-$"
|
||||
end
|
||||
@ -156,13 +155,6 @@ local function got(what)
|
||||
end)
|
||||
end
|
||||
|
||||
local function flatten(tbl)
|
||||
if #tbl == 1 then
|
||||
return tbl[1]
|
||||
end
|
||||
return tbl
|
||||
end
|
||||
|
||||
local function flatten_or_mark(name)
|
||||
return function(tbl)
|
||||
if #tbl == 1 then return tbl[1] end
|
||||
@ -234,7 +226,7 @@ end
|
||||
local function simple_string(delim, allow_interpolation)
|
||||
local inner = P('\\'..delim) + "\\\\" + (1 - P(delim))
|
||||
if allow_interpolation then
|
||||
inter = symx"#{" * V"Exp" * sym"}"
|
||||
local inter = symx"#{" * V"Exp" * sym"}"
|
||||
inner = (C((inner - inter)^1) + inter / mark"interpolate")^0
|
||||
else
|
||||
inner = C(inner^0)
|
||||
@ -280,16 +272,6 @@ local function wrap_decorator(stm, dec)
|
||||
return { "decorated", stm, dec }
|
||||
end
|
||||
|
||||
-- wrap if statement if there is a conditional decorator
|
||||
local function wrap_if(stm, cond)
|
||||
if cond then
|
||||
local pass, fail = unpack(cond)
|
||||
if fail then fail = {"else", {fail}} end
|
||||
return {"if", cond[2], {stm}, fail}
|
||||
end
|
||||
return stm
|
||||
end
|
||||
|
||||
local function check_lua_string(str, pos, right, left)
|
||||
return #left == #right
|
||||
end
|
||||
@ -343,18 +325,12 @@ local build_grammar = wrap_env(function()
|
||||
return true
|
||||
end
|
||||
|
||||
local function enable_do(str_pos)
|
||||
_do_stack:push(true)
|
||||
return true
|
||||
end
|
||||
|
||||
local function pop_do(str, pos)
|
||||
if nil == _do_stack:pop() then error("unexpected do pop") end
|
||||
return true
|
||||
end
|
||||
|
||||
local DisableDo = Cmt("", disable_do)
|
||||
local EnableDo = Cmt("", enable_do)
|
||||
local PopDo = Cmt("", pop_do)
|
||||
|
||||
local keywords = {}
|
||||
|
@ -23,7 +23,6 @@ do
|
||||
local _obj_0 = require("moonscript.errors")
|
||||
user_error = _obj_0.user_error
|
||||
end
|
||||
local util = require("moonscript.util")
|
||||
local join
|
||||
join = function(...)
|
||||
do
|
||||
|
@ -6,8 +6,6 @@ import unpack from require "moonscript.util"
|
||||
|
||||
import user_error from require "moonscript.errors"
|
||||
|
||||
util = require "moonscript.util"
|
||||
|
||||
join = (...) ->
|
||||
with out = {}
|
||||
i = 1
|
||||
|
Loading…
Reference in New Issue
Block a user