From 44d154ad94de20b4c327279c0ee52f4f34fc50c5 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sat, 9 Apr 2022 15:50:11 -0400 Subject: [EXEC] A small addition + .append() --- src/texec/eval.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/texec') 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} -- cgit v1.2.3