Expr represents an expression.
| 26 | |
| 27 | // Expr represents an expression. |
| 28 | type Expr interface { |
| 29 | fmt.Stringer |
| 30 | NodeFormatter |
| 31 | // Walk recursively walks all children using WalkExpr. If any children are changed, it returns a |
| 32 | // copy of this node updated to point to the new children. Otherwise the receiver is returned. |
| 33 | // For childless (leaf) Exprs, its implementation is empty. |
| 34 | Walk(Visitor) Expr |
| 35 | // TypeCheck transforms the Expr into a well-typed TypedExpr, which further permits |
| 36 | // evaluation and type introspection, or an error if the expression cannot be well-typed. |
| 37 | // When type checking is complete, if no error was reported, the expression and all |
| 38 | // sub-expressions will be guaranteed to be well-typed, meaning that the method effectively |
| 39 | // maps the Expr tree into a TypedExpr tree. |
| 40 | // |
| 41 | // The ctx parameter defines the context in which to perform type checking. |
| 42 | // The desired parameter hints the desired type that the method's caller wants from |
| 43 | // the resulting TypedExpr. It is not valid to call TypeCheck with a nil desired |
| 44 | // type. Instead, call it with wildcard type types.Any if no specific type is |
| 45 | // desired. This restriction is also true of most methods and functions related |
| 46 | // to type checking. |
| 47 | TypeCheck(ctx *SemaContext, desired *types.T) (TypedExpr, error) |
| 48 | } |
| 49 | |
| 50 | // TypedExpr represents a well-typed expression. |
| 51 | type TypedExpr interface { |
no outgoing calls
no test coverage detected
searching dependent graphs…