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

Method dot

compiler/semantic/expr.go:437–458  ·  view source on GitHub ↗
(e *ast.BinaryExpr, inType super.Type)

Source from the content-addressed store, hash-verified

435}
436
437func (t *translator) dot(e *ast.BinaryExpr, inType super.Type) (sem.Expr, super.Type) {
438 id, ok := e.RHS.(*ast.IDExpr)
439 if !ok {
440 t.error(e, errors.New("RHS of dot operator is not an identifier"))
441 return badExpr, badType
442 }
443 if lhs, ok := e.LHS.(*ast.IDExpr); ok {
444 // Check for plain-ID this (not double quoted) and resolve accordingly.
445 if lhs.Name == "this" && t.scope.sql != nil {
446 this, typ := t.scope.resolveThis(t, lhs, inType)
447 return t.deref(e, this, id, typ)
448 }
449 return t.dottedBaseCase(e, lhs, id, inType)
450 }
451 // Handle SQL double-quoted IDs without checking for this.
452 if lhs, ok := e.LHS.(*ast.DoubleQuoteExpr); ok && t.scope.sql != nil {
453 lhsID := &ast.IDExpr{ID: ast.ID{Name: lhs.Text, Loc: lhs.Loc}}
454 return t.dottedBaseCase(e, lhsID, id, inType)
455 }
456 lhs, typ := t.expr(e.LHS, inType)
457 return t.deref(e, lhs, id, typ)
458}
459
460func (t *translator) dottedBaseCase(loc ast.Node, lhs *ast.IDExpr, rhs *ast.IDExpr, inType super.Type) (sem.Expr, super.Type) {
461 if e, typ := t.idExpand(lhs, false, inType); e != nil {

Callers 1

binaryExprMethod · 0.95

Calls 6

derefMethod · 0.95
dottedBaseCaseMethod · 0.95
exprMethod · 0.95
NewMethod · 0.80
resolveThisMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected