Repository: abs-lang/abs (go)

Issue:
push function break loop
This code shows [0] instead of [0,1,2,3,4,5,6,7,8,9]
```
names = []
for x = 0; x < 10; x = x + 1 {
    names.push(x)
}
echo(names)
```

Pull request description:
Only explicit returns should interrupt for loops, closes #324

Patch:
diff --git a/evaluator/evaluator.go b/evaluator/evaluator.go
index ad8aeed..99af9bb 100644
--- a/evaluator/evaluator.go
+++ b/evaluator/evaluator.go
@@ -830,9 +830,14 @@ func evalForExpression(
 				case *object.Error:
 					return res
 				}
-			} else if res != NULL {
-				// We had a return from withink the FOR loop
+			}
+
+			// We had a return from within the FOR loop
+			switch res.(type) {
+			case *object.ReturnValue:
 				return res
+			default:
+				// do nothing
 			}
 
 			err = Eval(fe.Closer, env)
@@ -925,9 +930,14 @@ func loopIterable(next func() (object.Object, object.Object), env *object.Enviro
 			case *object.Error:
 				return res
 			}
-		} else if res != NULL {
-			// We had a return from withink the FOR..IN loop
+		}
+
+		// We had a return from within the FOR..IN loop
+		switch res.(type) {
+		case *object.ReturnValue:
 			return res
+		default:
+			// do nothing
 		}
 
 		// Let's increment our index, and


Test patch:
diff --git a/evaluator/evaluator_test.go b/evaluator/evaluator_test.go
index 41498f1..e87d436 100644
--- a/evaluator/evaluator_test.go
+++ b/evaluator/evaluator_test.go
@@ -269,6 +269,9 @@ func TestForExpressions(t *testing.T) {
 		{`y = {}; x = f() { for k = 0; k < 11; k = k + 1 { y.x = k; return null; }}; x(); y.x`, 0}, // https://github.com/abs-lang/abs/issues/303
 		{`y = {}; x = f() { for k = 0; k < 11; k = k + 1 { y.x = k; return 12; }}; x()`, 12},       // https://github.com/abs-lang/abs/issues/303
 		{`y = {}; x = f() { for k = 0; k < 11; k = k + 1 { y.x = k; }}; x(); y.x`, 10},             // https://github.com/abs-lang/abs/issues/303
+		{`y = []; for x in 1..10 { y.push(x) }; y.len()`, 10},                                      // https://github.com/abs-lang/abs/issues/324
+		{`y = []; for x in 1..10 { if true { y.push(x) } }; y.len()`, 10},                          // https://github.com/abs-lang/abs/issues/324
+		{`y = []; for x in 1..10 { if true { y.push(x); return 1 } }; y.len()`, 1},                 // https://github.com/abs-lang/abs/issues/324
 		{`x = 0; for k = 0; k < 11; k = k + 1 { if k < 10 { break; }; x += k }; x`, 0},
 		{`x = 0; for k = 0; k < 11; k = k + 1 { if k < 10 { continue; }; x += k }; x`, 10},
 		{"a = 0; for x = 0; x < 10; x = x + 1 { a = a + 1}; a", 10},