AstToCheckedExpr converts an Ast to an protobuf CheckedExpr value. If the Ast.IsChecked() returns false, this conversion method will return an error.
(a *Ast)
| 59 | // |
| 60 | // If the Ast.IsChecked() returns false, this conversion method will return an error. |
| 61 | func AstToCheckedExpr(a *Ast) (*exprpb.CheckedExpr, error) { |
| 62 | if !a.IsChecked() { |
| 63 | return nil, fmt.Errorf("cannot convert unchecked ast") |
| 64 | } |
| 65 | return ast.ToProto(a.NativeRep()) |
| 66 | } |
| 67 | |
| 68 | // ParsedExprToAst converts a parsed expression proto message to an Ast. |
| 69 | func ParsedExprToAst(parsedExpr *exprpb.ParsedExpr) *Ast { |