Loading Gopkg.lock +2 −2 Original line number Diff line number Diff line Loading @@ -454,7 +454,7 @@ version = "v1.1.9" [[projects]] digest = "1:87efccabe52f98f3dcefab803efba00d8b961cf942c1472a7db560eb64c125d5" digest = "1:a6fa18c481c713686f42ff0bd5eeaa2f4f9c389387fc9f9c1deacce355337c7d" name = "github.com/yuin/gopher-lua" packages = [ ".", Loading @@ -463,7 +463,7 @@ "pm", ] pruneopts = "" revision = "db9ae37725ec65ae634769088627d2d118faf06a" revision = "1e6e6e1918e02ddf02e667e88e8aa756942448c5" [[projects]] digest = "1:eb3da47361162f0ad991ddf391e6dc03e23889201d76046e2917687b84977aee" Loading Gopkg.toml +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ [[constraint]] name = "github.com/yuin/gopher-lua" revision = "db9ae37725ec65ae634769088627d2d118faf06a" revision = "1e6e6e1918e02ddf02e667e88e8aa756942448c5" [[constraint]] name = "github.com/gorhill/cronexpr" Loading vendor/github.com/yuin/gopher-lua/_glua-tests/issues.lua +14 −0 Original line number Diff line number Diff line Loading @@ -215,3 +215,17 @@ ok, message = pcall(function() pcall() end) assert(not ok and string.find(message, "bad argument #1 to pcall", 1, true)) -- issue 216 local function bar() return "bar" end local function test(foo) local should_not_change foo = foo or bar() print(should_not_change) return should_not_change end assert(test(nil) == nil) vendor/github.com/yuin/gopher-lua/compile.go +23 −5 Original line number Diff line number Diff line Loading @@ -65,6 +65,9 @@ var _ecnonem2 = &expcontext{ecNone, regNotDefined, -2} var ecfuncdef = &expcontext{ecMethod, regNotDefined, 0} func ecupdate(ec *expcontext, ctype expContextType, reg, varargopt int) { if ec == _ecnone0 || ec == _ecnonem1 || ec == _ecnonem2 { panic("can not update ec cache") } ec.ctype = ctype ec.reg = reg ec.varargopt = varargopt Loading Loading @@ -201,6 +204,15 @@ func (cd *codeStore) PropagateMV(top int, save *int, reg *int, inc int) { *reg = *reg + inc } func (cd *codeStore) AddLoadNil(a, b, line int) { last := cd.Last() if opGetOpCode(last) == OP_LOADNIL && (opGetArgA(last)+opGetArgB(last)) == a { cd.SetB(cd.LastPC(), b) } else { cd.AddABC(OP_LOADNIL, a, b, 0, line) } } func (cd *codeStore) SetOpCode(pc int, v int) { opSetOpCode(&cd.codes[pc], v) } Loading Loading @@ -661,7 +673,7 @@ func compileRegAssignment(context *funcContext, names []string, exprs []ast.Expr // extra left names if lennames > namesassigned { restleft := lennames - namesassigned - 1 context.Code.AddABC(OP_LOADNIL, reg, reg+restleft, 0, line) context.Code.AddLoadNil(reg, reg+restleft, line) reg += restleft } Loading Loading @@ -963,7 +975,7 @@ func compileExpr(context *funcContext, reg int, expr ast.Expr, ec *expcontext) i code.AddABx(OP_LOADK, sreg, context.ConstIndex(ex.Value), sline(ex)) return sused case *ast.NilExpr: code.AddABC(OP_LOADNIL, sreg, sreg, 0, sline(ex)) code.AddLoadNil(sreg, sreg, sline(ex)) return sused case *ast.FalseExpr: code.AddABC(OP_LOADBOOL, sreg, 0, 0, sline(ex)) Loading Loading @@ -1449,11 +1461,17 @@ func compileLogicalOpExprAux(context *funcContext, reg int, expr ast.Expr, ec *e return } if !hasnextcond && thenlabel == elselabel { reg += compileExpr(context, reg, expr, ec) } else { a := reg sreg := savereg(ec, a) if !hasnextcond && thenlabel == elselabel { reg += compileExpr(context, reg, expr, &expcontext{ec.ctype, intMax(a, sreg), ec.varargopt}) last := context.Code.Last() if opGetOpCode(last) == OP_MOVE && opGetArgA(last) == a { context.Code.SetA(context.Code.LastPC(), sreg) } else { context.Code.AddABC(OP_MOVE, sreg, a, 0, sline(expr)) } } else { reg += compileExpr(context, reg, expr, ecnone(0)) if sreg == a { code.AddABC(OP_TEST, a, 0, 0^flip, sline(expr)) Loading Loading
Gopkg.lock +2 −2 Original line number Diff line number Diff line Loading @@ -454,7 +454,7 @@ version = "v1.1.9" [[projects]] digest = "1:87efccabe52f98f3dcefab803efba00d8b961cf942c1472a7db560eb64c125d5" digest = "1:a6fa18c481c713686f42ff0bd5eeaa2f4f9c389387fc9f9c1deacce355337c7d" name = "github.com/yuin/gopher-lua" packages = [ ".", Loading @@ -463,7 +463,7 @@ "pm", ] pruneopts = "" revision = "db9ae37725ec65ae634769088627d2d118faf06a" revision = "1e6e6e1918e02ddf02e667e88e8aa756942448c5" [[projects]] digest = "1:eb3da47361162f0ad991ddf391e6dc03e23889201d76046e2917687b84977aee" Loading
Gopkg.toml +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ [[constraint]] name = "github.com/yuin/gopher-lua" revision = "db9ae37725ec65ae634769088627d2d118faf06a" revision = "1e6e6e1918e02ddf02e667e88e8aa756942448c5" [[constraint]] name = "github.com/gorhill/cronexpr" Loading
vendor/github.com/yuin/gopher-lua/_glua-tests/issues.lua +14 −0 Original line number Diff line number Diff line Loading @@ -215,3 +215,17 @@ ok, message = pcall(function() pcall() end) assert(not ok and string.find(message, "bad argument #1 to pcall", 1, true)) -- issue 216 local function bar() return "bar" end local function test(foo) local should_not_change foo = foo or bar() print(should_not_change) return should_not_change end assert(test(nil) == nil)
vendor/github.com/yuin/gopher-lua/compile.go +23 −5 Original line number Diff line number Diff line Loading @@ -65,6 +65,9 @@ var _ecnonem2 = &expcontext{ecNone, regNotDefined, -2} var ecfuncdef = &expcontext{ecMethod, regNotDefined, 0} func ecupdate(ec *expcontext, ctype expContextType, reg, varargopt int) { if ec == _ecnone0 || ec == _ecnonem1 || ec == _ecnonem2 { panic("can not update ec cache") } ec.ctype = ctype ec.reg = reg ec.varargopt = varargopt Loading Loading @@ -201,6 +204,15 @@ func (cd *codeStore) PropagateMV(top int, save *int, reg *int, inc int) { *reg = *reg + inc } func (cd *codeStore) AddLoadNil(a, b, line int) { last := cd.Last() if opGetOpCode(last) == OP_LOADNIL && (opGetArgA(last)+opGetArgB(last)) == a { cd.SetB(cd.LastPC(), b) } else { cd.AddABC(OP_LOADNIL, a, b, 0, line) } } func (cd *codeStore) SetOpCode(pc int, v int) { opSetOpCode(&cd.codes[pc], v) } Loading Loading @@ -661,7 +673,7 @@ func compileRegAssignment(context *funcContext, names []string, exprs []ast.Expr // extra left names if lennames > namesassigned { restleft := lennames - namesassigned - 1 context.Code.AddABC(OP_LOADNIL, reg, reg+restleft, 0, line) context.Code.AddLoadNil(reg, reg+restleft, line) reg += restleft } Loading Loading @@ -963,7 +975,7 @@ func compileExpr(context *funcContext, reg int, expr ast.Expr, ec *expcontext) i code.AddABx(OP_LOADK, sreg, context.ConstIndex(ex.Value), sline(ex)) return sused case *ast.NilExpr: code.AddABC(OP_LOADNIL, sreg, sreg, 0, sline(ex)) code.AddLoadNil(sreg, sreg, sline(ex)) return sused case *ast.FalseExpr: code.AddABC(OP_LOADBOOL, sreg, 0, 0, sline(ex)) Loading Loading @@ -1449,11 +1461,17 @@ func compileLogicalOpExprAux(context *funcContext, reg int, expr ast.Expr, ec *e return } if !hasnextcond && thenlabel == elselabel { reg += compileExpr(context, reg, expr, ec) } else { a := reg sreg := savereg(ec, a) if !hasnextcond && thenlabel == elselabel { reg += compileExpr(context, reg, expr, &expcontext{ec.ctype, intMax(a, sreg), ec.varargopt}) last := context.Code.Last() if opGetOpCode(last) == OP_MOVE && opGetArgA(last) == a { context.Code.SetA(context.Code.LastPC(), sreg) } else { context.Code.AddABC(OP_MOVE, sreg, a, 0, sline(expr)) } } else { reg += compileExpr(context, reg, expr, ecnone(0)) if sreg == a { code.AddABC(OP_TEST, a, 0, 0^flip, sline(expr)) Loading