func()

in dax/internal/parser/expression.go [394:438]


func (e *ExpressionEncoder) ExitFunctionCall(ctx *generated.FunctionCallContext) {
	if e.err != nil { // bail out
		return
	}

	fname := strings.ToLower(ctx.ID().GetText())
	var fn int
	switch fname {
	case "attribute_exists":
		fn = opAttributeExists
		break
	case "attribute_not_exists":
		fn = opAttributeNotExists
		break
	case "attribute_type":
		fn = opAttributeType
		break
	case "begins_with":
		fn = opBeginsWith
		break
	case "contains":
		fn = opContains
		break
	case "size":
		fn = opSize
		break
	case "if_not_exists":
		fn = opIfNotExists
		break
	case "list_append":
		fn = opListAppend
		break
	default:
		// parser will detect syntax error
	}

	n := (ctx.GetChildCount() - 2) / 2 // children = fname + '(' + numOperands*2-1 + ')'
	args := make([]sexpr, n)
	for n > 0 {
		n--
		args[n] = e.pop()
	}
	e.push(e.encodeFunction(fn, args))
	e.nestingLevel--
}