MCPcopy Create free account
hub / github.com/brimdata/super / fromFString

Method fromFString

compiler/semantic/op.go:200–216  ·  view source on GitHub ↗
(entity *ast.FromEval, args []ast.OpArg, seq sem.Seq)

Source from the content-addressed store, hash-verified

198}
199
200func (t *translator) fromFString(entity *ast.FromEval, args []ast.OpArg, seq sem.Seq) (sem.Seq, string) {
201 expr, _ := t.fstringExpr(entity.Expr, t.checker.unknown)
202 val, ok := t.maybeEval(expr)
203 if ok && !hasError(val) {
204 if bad := t.hasFromParent(entity, seq); bad != nil {
205 return bad, ""
206 }
207 return t.fromConst(val, entity, args)
208 }
209 // This is an expression so set up a robot scanner that pulls values from
210 // parent to decide what to scan.
211 return append(seq, &sem.RobotScan{
212 Node: entity,
213 Expr: expr,
214 Format: t.asFormatArg(args),
215 }), ""
216}
217
218func hasError(val super.Value) bool {
219 result := function.HasError{}.Call([]super.Value{val})

Callers 1

fromSourceMethod · 0.95

Calls 6

fstringExprMethod · 0.95
maybeEvalMethod · 0.95
hasFromParentMethod · 0.95
fromConstMethod · 0.95
asFormatArgMethod · 0.95
hasErrorFunction · 0.85

Tested by

no test coverage detected