moved a subset of source file to the kern package
This commit is contained in:
+9
-5
@@ -4,6 +4,10 @@
|
||||
// operator-dot.go
|
||||
package expr
|
||||
|
||||
import (
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
)
|
||||
|
||||
// -------- dot term
|
||||
func newDotTerm(tk *Token) (inst *term) {
|
||||
return &term{
|
||||
@@ -15,22 +19,22 @@ func newDotTerm(tk *Token) (inst *term) {
|
||||
}
|
||||
}
|
||||
|
||||
func evalDot(ctx ExprContext, opTerm *term) (v any, err error) {
|
||||
func evalDot(ctx kern.ExprContext, opTerm *term) (v any, err error) {
|
||||
var leftValue, rightValue any
|
||||
|
||||
if err = opTerm.checkOperands(); err != nil {
|
||||
return
|
||||
}
|
||||
if leftValue, err = opTerm.children[0].compute(ctx); err != nil {
|
||||
if leftValue, err = opTerm.children[0].Compute(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
indexTerm := opTerm.children[1]
|
||||
|
||||
switch unboxedValue := leftValue.(type) {
|
||||
case ExtIterator:
|
||||
case kern.ExtIterator:
|
||||
if indexTerm.symbol() == SymVariable /*|| indexTerm.symbol() == SymString */ {
|
||||
opName := indexTerm.source()
|
||||
opName := indexTerm.Source()
|
||||
if unboxedValue.HasOperation(opName) {
|
||||
v, err = unboxedValue.CallOperation(opName, map[string]any{})
|
||||
} else {
|
||||
@@ -41,7 +45,7 @@ func evalDot(ctx ExprContext, opTerm *term) (v any, err error) {
|
||||
err = indexTerm.tk.ErrorExpectedGot("identifier")
|
||||
}
|
||||
default:
|
||||
if rightValue, err = opTerm.children[1].compute(ctx); err == nil {
|
||||
if rightValue, err = opTerm.children[1].Compute(ctx); err == nil {
|
||||
err = opTerm.errIncompatibleTypes(leftValue, rightValue)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user