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