type interpretablePlanner … // newPlanner creates an interpretablePlanner which references a Dispatcher, TypeProvider, // TypeAdapter, Container, and CheckedExpr value. These pieces of data are used to resolve // functions, types, and namespaced identifiers at plan time rather than at runtime since // it only needs to be done once and may be semi-expensive to compute. func newPlanner(disp Dispatcher, provider types.Provider, adapter types.Adapter, attrFactory AttributeFactory, cont *containers.Container, exprAST *ast.AST, decorators ...InterpretableDecorator) interpretablePlanner { … } type planner … // Plan implements the interpretablePlanner interface. This implementation of the Plan method also // applies decorators to each Interpretable generated as part of the overall plan. Decorators are // useful for layering functionality into the evaluation that is not natively understood by CEL, // such as state-tracking, expression re-write, and possibly efficient thread-safe memoization of // repeated expressions. func (p *planner) Plan(expr ast.Expr) (Interpretable, error) { … } // decorate applies the InterpretableDecorator functions to the given Interpretable. // Both the Interpretable and error generated by a Plan step are accepted as arguments // for convenience. func (p *planner) decorate(i Interpretable, err error) (Interpretable, error) { … } // planIdent creates an Interpretable that resolves an identifier from an Activation. func (p *planner) planIdent(expr ast.Expr) (Interpretable, error) { … } func (p *planner) planCheckedIdent(id int64, identRef *ast.ReferenceInfo) (Interpretable, error) { … } // planSelect creates an Interpretable with either: // // a) selects a field from a map or proto. // b) creates a field presence test for a select within a has() macro. // c) resolves the select expression to a namespaced identifier. func (p *planner) planSelect(expr ast.Expr) (Interpretable, error) { … } // planCall creates a callable Interpretable while specializing for common functions and invocation // patterns. Specifically, conditional operators &&, ||, ?:, and (in)equality functions result in // optimized Interpretable values. func (p *planner) planCall(expr ast.Expr) (Interpretable, error) { … } // planCallZero generates a zero-arity callable Interpretable. func (p *planner) planCallZero(expr ast.Expr, function string, overload string, impl *functions.Overload) (Interpretable, error) { … } // planCallUnary generates a unary callable Interpretable. func (p *planner) planCallUnary(expr ast.Expr, function string, overload string, impl *functions.Overload, args []Interpretable) (Interpretable, error) { … } // planCallBinary generates a binary callable Interpretable. func (p *planner) planCallBinary(expr ast.Expr, function string, overload string, impl *functions.Overload, args []Interpretable) (Interpretable, error) { … } // planCallVarArgs generates a variable argument callable Interpretable. func (p *planner) planCallVarArgs(expr ast.Expr, function string, overload string, impl *functions.Overload, args []Interpretable) (Interpretable, error) { … } // planCallEqual generates an equals (==) Interpretable. func (p *planner) planCallEqual(expr ast.Expr, args []Interpretable) (Interpretable, error) { … } // planCallNotEqual generates a not equals (!=) Interpretable. func (p *planner) planCallNotEqual(expr ast.Expr, args []Interpretable) (Interpretable, error) { … } // planCallLogicalAnd generates a logical and (&&) Interpretable. func (p *planner) planCallLogicalAnd(expr ast.Expr, args []Interpretable) (Interpretable, error) { … } // planCallLogicalOr generates a logical or (||) Interpretable. func (p *planner) planCallLogicalOr(expr ast.Expr, args []Interpretable) (Interpretable, error) { … } // planCallConditional generates a conditional / ternary (c ? t : f) Interpretable. func (p *planner) planCallConditional(expr ast.Expr, args []Interpretable) (Interpretable, error) { … } // planCallIndex either extends an attribute with the argument to the index operation, or creates // a relative attribute based on the return of a function call or operation. func (p *planner) planCallIndex(expr ast.Expr, args []Interpretable, optional bool) (Interpretable, error) { … } // planCreateList generates a list construction Interpretable. func (p *planner) planCreateList(expr ast.Expr) (Interpretable, error) { … } // planCreateStruct generates a map or object construction Interpretable. func (p *planner) planCreateMap(expr ast.Expr) (Interpretable, error) { … } // planCreateObj generates an object construction Interpretable. func (p *planner) planCreateStruct(expr ast.Expr) (Interpretable, error) { … } // planComprehension generates an Interpretable fold operation. func (p *planner) planComprehension(expr ast.Expr) (Interpretable, error) { … } // planConst generates a constant valued Interpretable. func (p *planner) planConst(expr ast.Expr) (Interpretable, error) { … } // resolveTypeName takes a qualified string constructed at parse time, applies the proto // namespace resolution rules to it in a scan over possible matching types in the TypeProvider. func (p *planner) resolveTypeName(typeName string) (string, bool) { … } // resolveFunction determines the call target, function name, and overload name from a given Expr // value. // // The resolveFunction resolves ambiguities where a function may either be a receiver-style // invocation or a qualified global function name. // - The target expression may only consist of ident and select expressions. // - The function is declared in the environment using its fully-qualified name. // - The fully-qualified function name matches the string serialized target value. func (p *planner) resolveFunction(expr ast.Expr) (ast.Expr, string, string) { … } // relativeAttr indicates that the attribute in this case acts as a qualifier and as such needs to // be observed to ensure that it's evaluation value is properly recorded for state tracking. func (p *planner) relativeAttr(id int64, eval Interpretable, opt bool) (InterpretableAttribute, error) { … } // toQualifiedName converts an expression AST into a qualified name if possible, with a boolean // 'found' value that indicates if the conversion is successful. func (p *planner) toQualifiedName(operand ast.Expr) (string, bool) { … } func stripLeadingDot(name string) string { … }