// CheckedExprToAst converts a checked expression proto message to an Ast. func CheckedExprToAst(checkedExpr *exprpb.CheckedExpr) *Ast { … } // CheckedExprToAstWithSource converts a checked expression proto message to an Ast, // using the provided Source as the textual contents. // // In general the source is not necessary unless the AST has been modified between the // `Parse` and `Check` calls as an `Ast` created from the `Parse` step will carry the source // through future calls. // // Prefer CheckedExprToAst if loading expressions from storage. func CheckedExprToAstWithSource(checkedExpr *exprpb.CheckedExpr, src Source) (*Ast, error) { … } // AstToCheckedExpr converts an Ast to an protobuf CheckedExpr value. // // If the Ast.IsChecked() returns false, this conversion method will return an error. func AstToCheckedExpr(a *Ast) (*exprpb.CheckedExpr, error) { … } // ParsedExprToAst converts a parsed expression proto message to an Ast. func ParsedExprToAst(parsedExpr *exprpb.ParsedExpr) *Ast { … } // ParsedExprToAstWithSource converts a parsed expression proto message to an Ast, // using the provided Source as the textual contents. // // In general you only need this if you need to recheck a previously checked // expression, or if you need to separately check a subset of an expression. // // Prefer ParsedExprToAst if loading expressions from storage. func ParsedExprToAstWithSource(parsedExpr *exprpb.ParsedExpr, src Source) *Ast { … } // AstToParsedExpr converts an Ast to an protobuf ParsedExpr value. func AstToParsedExpr(a *Ast) (*exprpb.ParsedExpr, error) { … } // AstToString converts an Ast back to a string if possible. // // Note, the conversion may not be an exact replica of the original expression, but will produce // a string that is semantically equivalent and whose textual representation is stable. func AstToString(a *Ast) (string, error) { … } // RefValueToValue converts between ref.Val and api.expr.Value. // The result Value is the serialized proto form. The ref.Val must not be error or unknown. func RefValueToValue(res ref.Val) (*exprpb.Value, error) { … } var typeNameToTypeValue … var anyPbType … // ValueToRefValue converts between exprpb.Value and ref.Val. func ValueToRefValue(adapter types.Adapter, v *exprpb.Value) (ref.Val, error) { … }