at operator return -1 when fails in lists and arrays; insert operators (<< and >>) changes che container if it is a variable
This commit is contained in:
@@ -186,10 +186,32 @@ func (t *Term) GetChildSource(index int) (s string) {
|
||||
return
|
||||
}
|
||||
|
||||
func (t *Term) GetLeftChild() (c kern.Term) {
|
||||
if t.Position == PosInfix && len(t.Children) > 0 {
|
||||
c = t.Children[0]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (t *Term) GetRightChild() (c kern.Term) {
|
||||
if t.Position == PosInfix && len(t.Children) > 1 {
|
||||
c = t.Children[1]
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (t *Term) IsAssign() bool {
|
||||
return t.Symbol() == SymEqual
|
||||
}
|
||||
|
||||
func (t *Term) IsVar() bool {
|
||||
return t.Symbol() == SymVariable
|
||||
}
|
||||
|
||||
// func (t *Term) IsFunc() bool {
|
||||
// return t.Symbol() == SymFunction
|
||||
// }
|
||||
|
||||
func (t *Term) Compute(ctx kern.ExprContext) (v any, err error) {
|
||||
if t.EvalFunc == nil {
|
||||
err = t.Errorf("undefined eval-func for %q term", t.Source())
|
||||
|
||||
Reference in New Issue
Block a user