(e *ast.BinaryExpr, inType super.Type)
| 435 | } |
| 436 | |
| 437 | func (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 | |
| 460 | func (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 { |
no test coverage detected