Merge pull request #133 from mpeterv/remove_unused_variables

Removed some unused variables
This commit is contained in:
leaf 2014-03-23 23:44:19 -07:00
commit fb986e941c
9 changed files with 3 additions and 37 deletions

View File

@ -128,7 +128,6 @@ return {
insert_loader = insert_loader, insert_loader = insert_loader,
remove_loader = remove_loader, remove_loader = remove_loader,
to_lua = to_lua, to_lua = to_lua,
moon_chunk = moon_chunk,
moon_loader = moon_loader, moon_loader = moon_loader,
dirsep = dirsep, dirsep = dirsep,
dofile = dofile, dofile = dofile,

View File

@ -102,7 +102,7 @@ remove_loader = ->
{ {
_NAME: "moonscript" _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 :dofile, :loadfile, :loadstring
} }

View File

@ -102,7 +102,6 @@ do
end end
end end
insert(buffer, "\n") insert(buffer, "\n")
local last = l
elseif Lines == _exp_0 then elseif Lines == _exp_0 then
l:flatten(indent and indent .. indent_char or indent_char, buffer) l:flatten(indent and indent .. indent_char or indent_char, buffer)
else else
@ -696,7 +695,6 @@ tree = function(tree, options)
if not (success) then if not (success) then
local error_msg, error_pos local error_msg, error_pos
if type(err) == "table" then if type(err) == "table" then
local error_type = err[1]
local _exp_0 = err[1] local _exp_0 = err[1]
if "user-error" == _exp_0 or "compile-error" == _exp_0 then if "user-error" == _exp_0 or "compile-error" == _exp_0 then
error_msg, error_pos = unpack(err, 2) error_msg, error_pos = unpack(err, 2)

View File

@ -76,7 +76,6 @@ class Lines
insert buffer, ";" insert buffer, ";"
insert buffer, "\n" insert buffer, "\n"
last = l
when Lines when Lines
l\flatten indent and indent .. indent_char or indent_char, buffer l\flatten indent and indent .. indent_char or indent_char, buffer
else else
@ -452,7 +451,6 @@ tree = (tree, options={}) ->
unless success unless success
error_msg, error_pos = if type(err) == "table" error_msg, error_pos = if type(err) == "table"
error_type = err[1]
switch err[1] switch err[1]
when "user-error", "compile-error" when "user-error", "compile-error"
unpack err, 2 unpack err, 2

View File

@ -1,5 +1,4 @@
local util = require("moonscript.util") local util = require("moonscript.util")
local data = require("moonscript.data")
local reversed, unpack local reversed, unpack
reversed, unpack = util.reversed, util.unpack reversed, unpack = util.reversed, util.unpack
local ntype local ntype

View File

@ -1,6 +1,5 @@
util = require "moonscript.util" util = require "moonscript.util"
data = require "moonscript.data"
import reversed, unpack from util import reversed, unpack from util
import ntype from require "moonscript.types" import ntype from require "moonscript.types"

View File

@ -10,7 +10,6 @@ local types = require"moonscript.types"
local ntype = types.ntype local ntype = types.ntype
local dump = util.dump
local trim = util.trim local trim = util.trim
local getfenv = util.getfenv local getfenv = util.getfenv
@ -126,7 +125,7 @@ end
local function extract_line(str, start_pos) local function extract_line(str, start_pos)
str = str:sub(start_pos) str = str:sub(start_pos)
m = str:match"^(.-)\n" local m = str:match"^(.-)\n"
if m then return m end if m then return m end
return str:match"^.-$" return str:match"^.-$"
end end
@ -156,13 +155,6 @@ local function got(what)
end) end)
end end
local function flatten(tbl)
if #tbl == 1 then
return tbl[1]
end
return tbl
end
local function flatten_or_mark(name) local function flatten_or_mark(name)
return function(tbl) return function(tbl)
if #tbl == 1 then return tbl[1] end if #tbl == 1 then return tbl[1] end
@ -234,7 +226,7 @@ end
local function simple_string(delim, allow_interpolation) local function simple_string(delim, allow_interpolation)
local inner = P('\\'..delim) + "\\\\" + (1 - P(delim)) local inner = P('\\'..delim) + "\\\\" + (1 - P(delim))
if allow_interpolation then if allow_interpolation then
inter = symx"#{" * V"Exp" * sym"}" local inter = symx"#{" * V"Exp" * sym"}"
inner = (C((inner - inter)^1) + inter / mark"interpolate")^0 inner = (C((inner - inter)^1) + inter / mark"interpolate")^0
else else
inner = C(inner^0) inner = C(inner^0)
@ -280,16 +272,6 @@ local function wrap_decorator(stm, dec)
return { "decorated", stm, dec } return { "decorated", stm, dec }
end 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) local function check_lua_string(str, pos, right, left)
return #left == #right return #left == #right
end end
@ -343,18 +325,12 @@ local build_grammar = wrap_env(function()
return true return true
end end
local function enable_do(str_pos)
_do_stack:push(true)
return true
end
local function pop_do(str, pos) local function pop_do(str, pos)
if nil == _do_stack:pop() then error("unexpected do pop") end if nil == _do_stack:pop() then error("unexpected do pop") end
return true return true
end end
local DisableDo = Cmt("", disable_do) local DisableDo = Cmt("", disable_do)
local EnableDo = Cmt("", enable_do)
local PopDo = Cmt("", pop_do) local PopDo = Cmt("", pop_do)
local keywords = {} local keywords = {}

View File

@ -23,7 +23,6 @@ do
local _obj_0 = require("moonscript.errors") local _obj_0 = require("moonscript.errors")
user_error = _obj_0.user_error user_error = _obj_0.user_error
end end
local util = require("moonscript.util")
local join local join
join = function(...) join = function(...)
do do

View File

@ -6,8 +6,6 @@ import unpack from require "moonscript.util"
import user_error from require "moonscript.errors" import user_error from require "moonscript.errors"
util = require "moonscript.util"
join = (...) -> join = (...) ->
with out = {} with out = {}
i = 1 i = 1