summaryrefslogtreecommitdiff
path: root/src/texec
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-04-09 15:50:11 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-04-09 15:50:11 -0400
commit44d154ad94de20b4c327279c0ee52f4f34fc50c5 (patch)
tree39bdae54db7038d9e079eb8fd4099b3fbdfc100a /src/texec
parentb95147cc49ac2e66a7837a8d15e45ef376736314 (diff)
[EXEC] A small addition
+ <array>.append(<value>)
Diffstat (limited to 'src/texec')
-rw-r--r--src/texec/eval.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/texec/eval.go b/src/texec/eval.go
index 56d2e21..a2c7b8d 100644
--- a/src/texec/eval.go
+++ b/src/texec/eval.go
@@ -714,6 +714,13 @@ func isArray(t TType, skp int) bool {
// Deals with call and index nodes
func evalCIN(v tparse.Node, ctx *VarMap, wk *TVariable) *TVariable {
if v.Sub[0].Data.Data == "call" {
+ if v.Data.Data == "append" && isArray(wk.Type, 0) {
+ tmp := convertVal(evalValue(v.Sub[0].Sub[0], ctx), stripType(wk.Type, 1))
+ i := len((*(wk.Data.(*interface{}))).([]interface{}))
+ *(wk.Data.(*interface{})) = append((*(wk.Data.(*interface{}))).([]interface{}), tmp.Data)
+ return &TVariable{stripType(wk.Type, 1), &((*(wk.Data.(*interface{}))).([]interface{})[i])}
+ }
+
args := []TVariable{}
pth := TArtifact{[]string{}, v.Data.Data}