summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/d5/tengo
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/d5/tengo')
-rw-r--r--vendor/github.com/d5/tengo/v2/compiler.go24
1 files changed, 5 insertions, 19 deletions
diff --git a/vendor/github.com/d5/tengo/v2/compiler.go b/vendor/github.com/d5/tengo/v2/compiler.go
index 0d46a4d7..f5fc5536 100644
--- a/vendor/github.com/d5/tengo/v2/compiler.go
+++ b/vendor/github.com/d5/tengo/v2/compiler.go
@@ -141,25 +141,7 @@ func (c *Compiler) Compile(node parser.Node) error {
if node.Token == token.LAnd || node.Token == token.LOr {
return c.compileLogical(node)
}
- if node.Token == token.Less {
- if err := c.Compile(node.RHS); err != nil {
- return err
- }
- if err := c.Compile(node.LHS); err != nil {
- return err
- }
- c.emit(node, parser.OpBinaryOp, int(token.Greater))
- return nil
- } else if node.Token == token.LessEq {
- if err := c.Compile(node.RHS); err != nil {
- return err
- }
- if err := c.Compile(node.LHS); err != nil {
- return err
- }
- c.emit(node, parser.OpBinaryOp, int(token.GreaterEq))
- return nil
- }
+
if err := c.Compile(node.LHS); err != nil {
return err
}
@@ -182,6 +164,10 @@ func (c *Compiler) Compile(node parser.Node) error {
c.emit(node, parser.OpBinaryOp, int(token.Greater))
case token.GreaterEq:
c.emit(node, parser.OpBinaryOp, int(token.GreaterEq))
+ case token.Less:
+ c.emit(node, parser.OpBinaryOp, int(token.Less))
+ case token.LessEq:
+ c.emit(node, parser.OpBinaryOp, int(token.LessEq))
case token.Equal:
c.emit(node, parser.OpEqual)
case token.NotEqual: