Skip to content

Commit

Permalink
cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
yuin committed May 8, 2015
1 parent bd6e94c commit 56bfa99
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,6 @@ func raiseCompileError(context *funcContext, line int, format string, args ...in
panic(&CompileError{Context: context, Line: line, Message: msg})
}

func isConstFoldableExpr(ex ast.Expr) bool {
switch ex.(type) {
case *ast.NumberExpr, *constLValueExpr:
return true
}
return false
}

func isVarArgReturnExpr(expr ast.Expr) bool {
switch ex := expr.(type) {
case *ast.FuncCallExpr:
Expand Down Expand Up @@ -1347,19 +1339,14 @@ func compileLogicalOpExpr(context *funcContext, reg int, expr *ast.LogicalOpExpr
compileLogicalOpExprAux(context, reg, expr.Rhs, ec, endlabel, endlabel, false, lb)
}

lastinst := code.Last()
if opGetOpCode(lastinst) == OP_JMP && opGetArgSbx(lastinst) == lb.f {
code.Pop()
}

if lb.b {
context.SetLabelPc(lb.f, code.LastPC())
code.AddABC(OP_LOADBOOL, a, 0, 1, sline(expr))
context.SetLabelPc(lb.t, code.LastPC())
code.AddABC(OP_LOADBOOL, a, 1, 0, sline(expr))
}

lastinst = code.Last()
lastinst := code.Last()
if opGetOpCode(lastinst) == OP_JMP && opGetArgSbx(lastinst) == endlabel {
code.Pop()
}
Expand Down Expand Up @@ -1532,8 +1519,6 @@ func getExprName(context *funcContext, expr ast.Expr) string { // {{{
switch ex := expr.(type) {
case *ast.IdentExpr:
return ex.Value
case *ast.StringExpr:
return ex.Value
case *ast.AttrGetExpr:
switch kex := ex.Key.(type) {
case *ast.StringExpr:
Expand Down

0 comments on commit 56bfa99

Please sign in to comment.