1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 Google LLC 2*d5c09012SAndroid Build Coastguard Worker// 3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); 4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License. 5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at 6*d5c09012SAndroid Build Coastguard Worker// 7*d5c09012SAndroid Build Coastguard Worker// http://www.apache.org/licenses/LICENSE-2.0 8*d5c09012SAndroid Build Coastguard Worker// 9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software 10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, 11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and 13*d5c09012SAndroid Build Coastguard Worker// limitations under the License. 14*d5c09012SAndroid Build Coastguard Worker 15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3"; 16*d5c09012SAndroid Build Coastguard Worker 17*d5c09012SAndroid Build Coastguard Workerpackage google.api.expr.v1alpha1; 18*d5c09012SAndroid Build Coastguard Worker 19*d5c09012SAndroid Build Coastguard Workerimport "google/api/expr/v1alpha1/syntax.proto"; 20*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/empty.proto"; 21*d5c09012SAndroid Build Coastguard Workerimport "google/protobuf/struct.proto"; 22*d5c09012SAndroid Build Coastguard Worker 23*d5c09012SAndroid Build Coastguard Workeroption cc_enable_arenas = true; 24*d5c09012SAndroid Build Coastguard Workeroption go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; 25*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true; 26*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "DeclProto"; 27*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.api.expr.v1alpha1"; 28*d5c09012SAndroid Build Coastguard Worker 29*d5c09012SAndroid Build Coastguard Worker// Protos for representing CEL declarations and typed checked expressions. 30*d5c09012SAndroid Build Coastguard Worker 31*d5c09012SAndroid Build Coastguard Worker// A CEL expression which has been successfully type checked. 32*d5c09012SAndroid Build Coastguard Workermessage CheckedExpr { 33*d5c09012SAndroid Build Coastguard Worker // A map from expression ids to resolved references. 34*d5c09012SAndroid Build Coastguard Worker // 35*d5c09012SAndroid Build Coastguard Worker // The following entries are in this table: 36*d5c09012SAndroid Build Coastguard Worker // 37*d5c09012SAndroid Build Coastguard Worker // - An Ident or Select expression is represented here if it resolves to a 38*d5c09012SAndroid Build Coastguard Worker // declaration. For instance, if `a.b.c` is represented by 39*d5c09012SAndroid Build Coastguard Worker // `select(select(id(a), b), c)`, and `a.b` resolves to a declaration, 40*d5c09012SAndroid Build Coastguard Worker // while `c` is a field selection, then the reference is attached to the 41*d5c09012SAndroid Build Coastguard Worker // nested select expression (but not to the id or or the outer select). 42*d5c09012SAndroid Build Coastguard Worker // In turn, if `a` resolves to a declaration and `b.c` are field selections, 43*d5c09012SAndroid Build Coastguard Worker // the reference is attached to the ident expression. 44*d5c09012SAndroid Build Coastguard Worker // - Every Call expression has an entry here, identifying the function being 45*d5c09012SAndroid Build Coastguard Worker // called. 46*d5c09012SAndroid Build Coastguard Worker // - Every CreateStruct expression for a message has an entry, identifying 47*d5c09012SAndroid Build Coastguard Worker // the message. 48*d5c09012SAndroid Build Coastguard Worker map<int64, Reference> reference_map = 2; 49*d5c09012SAndroid Build Coastguard Worker 50*d5c09012SAndroid Build Coastguard Worker // A map from expression ids to types. 51*d5c09012SAndroid Build Coastguard Worker // 52*d5c09012SAndroid Build Coastguard Worker // Every expression node which has a type different than DYN has a mapping 53*d5c09012SAndroid Build Coastguard Worker // here. If an expression has type DYN, it is omitted from this map to save 54*d5c09012SAndroid Build Coastguard Worker // space. 55*d5c09012SAndroid Build Coastguard Worker map<int64, Type> type_map = 3; 56*d5c09012SAndroid Build Coastguard Worker 57*d5c09012SAndroid Build Coastguard Worker // The source info derived from input that generated the parsed `expr` and 58*d5c09012SAndroid Build Coastguard Worker // any optimizations made during the type-checking pass. 59*d5c09012SAndroid Build Coastguard Worker SourceInfo source_info = 5; 60*d5c09012SAndroid Build Coastguard Worker 61*d5c09012SAndroid Build Coastguard Worker // The expr version indicates the major / minor version number of the `expr` 62*d5c09012SAndroid Build Coastguard Worker // representation. 63*d5c09012SAndroid Build Coastguard Worker // 64*d5c09012SAndroid Build Coastguard Worker // The most common reason for a version change will be to indicate to the CEL 65*d5c09012SAndroid Build Coastguard Worker // runtimes that transformations have been performed on the expr during static 66*d5c09012SAndroid Build Coastguard Worker // analysis. In some cases, this will save the runtime the work of applying 67*d5c09012SAndroid Build Coastguard Worker // the same or similar transformations prior to evaluation. 68*d5c09012SAndroid Build Coastguard Worker string expr_version = 6; 69*d5c09012SAndroid Build Coastguard Worker 70*d5c09012SAndroid Build Coastguard Worker // The checked expression. Semantically equivalent to the parsed `expr`, but 71*d5c09012SAndroid Build Coastguard Worker // may have structural differences. 72*d5c09012SAndroid Build Coastguard Worker Expr expr = 4; 73*d5c09012SAndroid Build Coastguard Worker} 74*d5c09012SAndroid Build Coastguard Worker 75*d5c09012SAndroid Build Coastguard Worker// Represents a CEL type. 76*d5c09012SAndroid Build Coastguard Workermessage Type { 77*d5c09012SAndroid Build Coastguard Worker // List type with typed elements, e.g. `list<example.proto.MyMessage>`. 78*d5c09012SAndroid Build Coastguard Worker message ListType { 79*d5c09012SAndroid Build Coastguard Worker // The element type. 80*d5c09012SAndroid Build Coastguard Worker Type elem_type = 1; 81*d5c09012SAndroid Build Coastguard Worker } 82*d5c09012SAndroid Build Coastguard Worker 83*d5c09012SAndroid Build Coastguard Worker // Map type with parameterized key and value types, e.g. `map<string, int>`. 84*d5c09012SAndroid Build Coastguard Worker message MapType { 85*d5c09012SAndroid Build Coastguard Worker // The type of the key. 86*d5c09012SAndroid Build Coastguard Worker Type key_type = 1; 87*d5c09012SAndroid Build Coastguard Worker 88*d5c09012SAndroid Build Coastguard Worker // The type of the value. 89*d5c09012SAndroid Build Coastguard Worker Type value_type = 2; 90*d5c09012SAndroid Build Coastguard Worker } 91*d5c09012SAndroid Build Coastguard Worker 92*d5c09012SAndroid Build Coastguard Worker // Function type with result and arg types. 93*d5c09012SAndroid Build Coastguard Worker message FunctionType { 94*d5c09012SAndroid Build Coastguard Worker // Result type of the function. 95*d5c09012SAndroid Build Coastguard Worker Type result_type = 1; 96*d5c09012SAndroid Build Coastguard Worker 97*d5c09012SAndroid Build Coastguard Worker // Argument types of the function. 98*d5c09012SAndroid Build Coastguard Worker repeated Type arg_types = 2; 99*d5c09012SAndroid Build Coastguard Worker } 100*d5c09012SAndroid Build Coastguard Worker 101*d5c09012SAndroid Build Coastguard Worker // Application defined abstract type. 102*d5c09012SAndroid Build Coastguard Worker message AbstractType { 103*d5c09012SAndroid Build Coastguard Worker // The fully qualified name of this abstract type. 104*d5c09012SAndroid Build Coastguard Worker string name = 1; 105*d5c09012SAndroid Build Coastguard Worker 106*d5c09012SAndroid Build Coastguard Worker // Parameter types for this abstract type. 107*d5c09012SAndroid Build Coastguard Worker repeated Type parameter_types = 2; 108*d5c09012SAndroid Build Coastguard Worker } 109*d5c09012SAndroid Build Coastguard Worker 110*d5c09012SAndroid Build Coastguard Worker // CEL primitive types. 111*d5c09012SAndroid Build Coastguard Worker enum PrimitiveType { 112*d5c09012SAndroid Build Coastguard Worker // Unspecified type. 113*d5c09012SAndroid Build Coastguard Worker PRIMITIVE_TYPE_UNSPECIFIED = 0; 114*d5c09012SAndroid Build Coastguard Worker 115*d5c09012SAndroid Build Coastguard Worker // Boolean type. 116*d5c09012SAndroid Build Coastguard Worker BOOL = 1; 117*d5c09012SAndroid Build Coastguard Worker 118*d5c09012SAndroid Build Coastguard Worker // Int64 type. 119*d5c09012SAndroid Build Coastguard Worker // 120*d5c09012SAndroid Build Coastguard Worker // Proto-based integer values are widened to int64. 121*d5c09012SAndroid Build Coastguard Worker INT64 = 2; 122*d5c09012SAndroid Build Coastguard Worker 123*d5c09012SAndroid Build Coastguard Worker // Uint64 type. 124*d5c09012SAndroid Build Coastguard Worker // 125*d5c09012SAndroid Build Coastguard Worker // Proto-based unsigned integer values are widened to uint64. 126*d5c09012SAndroid Build Coastguard Worker UINT64 = 3; 127*d5c09012SAndroid Build Coastguard Worker 128*d5c09012SAndroid Build Coastguard Worker // Double type. 129*d5c09012SAndroid Build Coastguard Worker // 130*d5c09012SAndroid Build Coastguard Worker // Proto-based float values are widened to double values. 131*d5c09012SAndroid Build Coastguard Worker DOUBLE = 4; 132*d5c09012SAndroid Build Coastguard Worker 133*d5c09012SAndroid Build Coastguard Worker // String type. 134*d5c09012SAndroid Build Coastguard Worker STRING = 5; 135*d5c09012SAndroid Build Coastguard Worker 136*d5c09012SAndroid Build Coastguard Worker // Bytes type. 137*d5c09012SAndroid Build Coastguard Worker BYTES = 6; 138*d5c09012SAndroid Build Coastguard Worker } 139*d5c09012SAndroid Build Coastguard Worker 140*d5c09012SAndroid Build Coastguard Worker // Well-known protobuf types treated with first-class support in CEL. 141*d5c09012SAndroid Build Coastguard Worker enum WellKnownType { 142*d5c09012SAndroid Build Coastguard Worker // Unspecified type. 143*d5c09012SAndroid Build Coastguard Worker WELL_KNOWN_TYPE_UNSPECIFIED = 0; 144*d5c09012SAndroid Build Coastguard Worker 145*d5c09012SAndroid Build Coastguard Worker // Well-known protobuf.Any type. 146*d5c09012SAndroid Build Coastguard Worker // 147*d5c09012SAndroid Build Coastguard Worker // Any types are a polymorphic message type. During type-checking they are 148*d5c09012SAndroid Build Coastguard Worker // treated like `DYN` types, but at runtime they are resolved to a specific 149*d5c09012SAndroid Build Coastguard Worker // message type specified at evaluation time. 150*d5c09012SAndroid Build Coastguard Worker ANY = 1; 151*d5c09012SAndroid Build Coastguard Worker 152*d5c09012SAndroid Build Coastguard Worker // Well-known protobuf.Timestamp type, internally referenced as `timestamp`. 153*d5c09012SAndroid Build Coastguard Worker TIMESTAMP = 2; 154*d5c09012SAndroid Build Coastguard Worker 155*d5c09012SAndroid Build Coastguard Worker // Well-known protobuf.Duration type, internally referenced as `duration`. 156*d5c09012SAndroid Build Coastguard Worker DURATION = 3; 157*d5c09012SAndroid Build Coastguard Worker } 158*d5c09012SAndroid Build Coastguard Worker 159*d5c09012SAndroid Build Coastguard Worker // The kind of type. 160*d5c09012SAndroid Build Coastguard Worker oneof type_kind { 161*d5c09012SAndroid Build Coastguard Worker // Dynamic type. 162*d5c09012SAndroid Build Coastguard Worker google.protobuf.Empty dyn = 1; 163*d5c09012SAndroid Build Coastguard Worker 164*d5c09012SAndroid Build Coastguard Worker // Null value. 165*d5c09012SAndroid Build Coastguard Worker google.protobuf.NullValue null = 2; 166*d5c09012SAndroid Build Coastguard Worker 167*d5c09012SAndroid Build Coastguard Worker // Primitive types: `true`, `1u`, `-2.0`, `'string'`, `b'bytes'`. 168*d5c09012SAndroid Build Coastguard Worker PrimitiveType primitive = 3; 169*d5c09012SAndroid Build Coastguard Worker 170*d5c09012SAndroid Build Coastguard Worker // Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`. 171*d5c09012SAndroid Build Coastguard Worker PrimitiveType wrapper = 4; 172*d5c09012SAndroid Build Coastguard Worker 173*d5c09012SAndroid Build Coastguard Worker // Well-known protobuf type such as `google.protobuf.Timestamp`. 174*d5c09012SAndroid Build Coastguard Worker WellKnownType well_known = 5; 175*d5c09012SAndroid Build Coastguard Worker 176*d5c09012SAndroid Build Coastguard Worker // Parameterized list with elements of `list_type`, e.g. `list<timestamp>`. 177*d5c09012SAndroid Build Coastguard Worker ListType list_type = 6; 178*d5c09012SAndroid Build Coastguard Worker 179*d5c09012SAndroid Build Coastguard Worker // Parameterized map with typed keys and values. 180*d5c09012SAndroid Build Coastguard Worker MapType map_type = 7; 181*d5c09012SAndroid Build Coastguard Worker 182*d5c09012SAndroid Build Coastguard Worker // Function type. 183*d5c09012SAndroid Build Coastguard Worker FunctionType function = 8; 184*d5c09012SAndroid Build Coastguard Worker 185*d5c09012SAndroid Build Coastguard Worker // Protocol buffer message type. 186*d5c09012SAndroid Build Coastguard Worker // 187*d5c09012SAndroid Build Coastguard Worker // The `message_type` string specifies the qualified message type name. For 188*d5c09012SAndroid Build Coastguard Worker // example, `google.plus.Profile`. 189*d5c09012SAndroid Build Coastguard Worker string message_type = 9; 190*d5c09012SAndroid Build Coastguard Worker 191*d5c09012SAndroid Build Coastguard Worker // Type param type. 192*d5c09012SAndroid Build Coastguard Worker // 193*d5c09012SAndroid Build Coastguard Worker // The `type_param` string specifies the type parameter name, e.g. `list<E>` 194*d5c09012SAndroid Build Coastguard Worker // would be a `list_type` whose element type was a `type_param` type 195*d5c09012SAndroid Build Coastguard Worker // named `E`. 196*d5c09012SAndroid Build Coastguard Worker string type_param = 10; 197*d5c09012SAndroid Build Coastguard Worker 198*d5c09012SAndroid Build Coastguard Worker // Type type. 199*d5c09012SAndroid Build Coastguard Worker // 200*d5c09012SAndroid Build Coastguard Worker // The `type` value specifies the target type. e.g. int is type with a 201*d5c09012SAndroid Build Coastguard Worker // target type of `Primitive.INT`. 202*d5c09012SAndroid Build Coastguard Worker Type type = 11; 203*d5c09012SAndroid Build Coastguard Worker 204*d5c09012SAndroid Build Coastguard Worker // Error type. 205*d5c09012SAndroid Build Coastguard Worker // 206*d5c09012SAndroid Build Coastguard Worker // During type-checking if an expression is an error, its type is propagated 207*d5c09012SAndroid Build Coastguard Worker // as the `ERROR` type. This permits the type-checker to discover other 208*d5c09012SAndroid Build Coastguard Worker // errors present in the expression. 209*d5c09012SAndroid Build Coastguard Worker google.protobuf.Empty error = 12; 210*d5c09012SAndroid Build Coastguard Worker 211*d5c09012SAndroid Build Coastguard Worker // Abstract, application defined type. 212*d5c09012SAndroid Build Coastguard Worker AbstractType abstract_type = 14; 213*d5c09012SAndroid Build Coastguard Worker } 214*d5c09012SAndroid Build Coastguard Worker} 215*d5c09012SAndroid Build Coastguard Worker 216*d5c09012SAndroid Build Coastguard Worker// Represents a declaration of a named value or function. 217*d5c09012SAndroid Build Coastguard Worker// 218*d5c09012SAndroid Build Coastguard Worker// A declaration is part of the contract between the expression, the agent 219*d5c09012SAndroid Build Coastguard Worker// evaluating that expression, and the caller requesting evaluation. 220*d5c09012SAndroid Build Coastguard Workermessage Decl { 221*d5c09012SAndroid Build Coastguard Worker // Identifier declaration which specifies its type and optional `Expr` value. 222*d5c09012SAndroid Build Coastguard Worker // 223*d5c09012SAndroid Build Coastguard Worker // An identifier without a value is a declaration that must be provided at 224*d5c09012SAndroid Build Coastguard Worker // evaluation time. An identifier with a value should resolve to a constant, 225*d5c09012SAndroid Build Coastguard Worker // but may be used in conjunction with other identifiers bound at evaluation 226*d5c09012SAndroid Build Coastguard Worker // time. 227*d5c09012SAndroid Build Coastguard Worker message IdentDecl { 228*d5c09012SAndroid Build Coastguard Worker // Required. The type of the identifier. 229*d5c09012SAndroid Build Coastguard Worker Type type = 1; 230*d5c09012SAndroid Build Coastguard Worker 231*d5c09012SAndroid Build Coastguard Worker // The constant value of the identifier. If not specified, the identifier 232*d5c09012SAndroid Build Coastguard Worker // must be supplied at evaluation time. 233*d5c09012SAndroid Build Coastguard Worker Constant value = 2; 234*d5c09012SAndroid Build Coastguard Worker 235*d5c09012SAndroid Build Coastguard Worker // Documentation string for the identifier. 236*d5c09012SAndroid Build Coastguard Worker string doc = 3; 237*d5c09012SAndroid Build Coastguard Worker } 238*d5c09012SAndroid Build Coastguard Worker 239*d5c09012SAndroid Build Coastguard Worker // Function declaration specifies one or more overloads which indicate the 240*d5c09012SAndroid Build Coastguard Worker // function's parameter types and return type. 241*d5c09012SAndroid Build Coastguard Worker // 242*d5c09012SAndroid Build Coastguard Worker // Functions have no observable side-effects (there may be side-effects like 243*d5c09012SAndroid Build Coastguard Worker // logging which are not observable from CEL). 244*d5c09012SAndroid Build Coastguard Worker message FunctionDecl { 245*d5c09012SAndroid Build Coastguard Worker // An overload indicates a function's parameter types and return type, and 246*d5c09012SAndroid Build Coastguard Worker // may optionally include a function body described in terms of 247*d5c09012SAndroid Build Coastguard Worker // [Expr][google.api.expr.v1alpha1.Expr] values. 248*d5c09012SAndroid Build Coastguard Worker // 249*d5c09012SAndroid Build Coastguard Worker // Functions overloads are declared in either a function or method 250*d5c09012SAndroid Build Coastguard Worker // call-style. For methods, the `params[0]` is the expected type of the 251*d5c09012SAndroid Build Coastguard Worker // target receiver. 252*d5c09012SAndroid Build Coastguard Worker // 253*d5c09012SAndroid Build Coastguard Worker // Overloads must have non-overlapping argument types after erasure of all 254*d5c09012SAndroid Build Coastguard Worker // parameterized type variables (similar as type erasure in Java). 255*d5c09012SAndroid Build Coastguard Worker message Overload { 256*d5c09012SAndroid Build Coastguard Worker // Required. Globally unique overload name of the function which reflects 257*d5c09012SAndroid Build Coastguard Worker // the function name and argument types. 258*d5c09012SAndroid Build Coastguard Worker // 259*d5c09012SAndroid Build Coastguard Worker // This will be used by a [Reference][google.api.expr.v1alpha1.Reference] 260*d5c09012SAndroid Build Coastguard Worker // to indicate the `overload_id` that was resolved for the function 261*d5c09012SAndroid Build Coastguard Worker // `name`. 262*d5c09012SAndroid Build Coastguard Worker string overload_id = 1; 263*d5c09012SAndroid Build Coastguard Worker 264*d5c09012SAndroid Build Coastguard Worker // List of function parameter [Type][google.api.expr.v1alpha1.Type] 265*d5c09012SAndroid Build Coastguard Worker // values. 266*d5c09012SAndroid Build Coastguard Worker // 267*d5c09012SAndroid Build Coastguard Worker // Param types are disjoint after generic type parameters have been 268*d5c09012SAndroid Build Coastguard Worker // replaced with the type `DYN`. Since the `DYN` type is compatible with 269*d5c09012SAndroid Build Coastguard Worker // any other type, this means that if `A` is a type parameter, the 270*d5c09012SAndroid Build Coastguard Worker // function types `int<A>` and `int<int>` are not disjoint. Likewise, 271*d5c09012SAndroid Build Coastguard Worker // `map<string, string>` is not disjoint from `map<K, V>`. 272*d5c09012SAndroid Build Coastguard Worker // 273*d5c09012SAndroid Build Coastguard Worker // When the `result_type` of a function is a generic type param, the 274*d5c09012SAndroid Build Coastguard Worker // type param name also appears as the `type` of on at least one params. 275*d5c09012SAndroid Build Coastguard Worker repeated Type params = 2; 276*d5c09012SAndroid Build Coastguard Worker 277*d5c09012SAndroid Build Coastguard Worker // The type param names associated with the function declaration. 278*d5c09012SAndroid Build Coastguard Worker // 279*d5c09012SAndroid Build Coastguard Worker // For example, `function ex<K,V>(K key, map<K, V> map) : V` would yield 280*d5c09012SAndroid Build Coastguard Worker // the type params of `K, V`. 281*d5c09012SAndroid Build Coastguard Worker repeated string type_params = 3; 282*d5c09012SAndroid Build Coastguard Worker 283*d5c09012SAndroid Build Coastguard Worker // Required. The result type of the function. For example, the operator 284*d5c09012SAndroid Build Coastguard Worker // `string.isEmpty()` would have `result_type` of `kind: BOOL`. 285*d5c09012SAndroid Build Coastguard Worker Type result_type = 4; 286*d5c09012SAndroid Build Coastguard Worker 287*d5c09012SAndroid Build Coastguard Worker // Whether the function is to be used in a method call-style `x.f(...)` 288*d5c09012SAndroid Build Coastguard Worker // or a function call-style `f(x, ...)`. 289*d5c09012SAndroid Build Coastguard Worker // 290*d5c09012SAndroid Build Coastguard Worker // For methods, the first parameter declaration, `params[0]` is the 291*d5c09012SAndroid Build Coastguard Worker // expected type of the target receiver. 292*d5c09012SAndroid Build Coastguard Worker bool is_instance_function = 5; 293*d5c09012SAndroid Build Coastguard Worker 294*d5c09012SAndroid Build Coastguard Worker // Documentation string for the overload. 295*d5c09012SAndroid Build Coastguard Worker string doc = 6; 296*d5c09012SAndroid Build Coastguard Worker } 297*d5c09012SAndroid Build Coastguard Worker 298*d5c09012SAndroid Build Coastguard Worker // Required. List of function overloads, must contain at least one overload. 299*d5c09012SAndroid Build Coastguard Worker repeated Overload overloads = 1; 300*d5c09012SAndroid Build Coastguard Worker } 301*d5c09012SAndroid Build Coastguard Worker 302*d5c09012SAndroid Build Coastguard Worker // The fully qualified name of the declaration. 303*d5c09012SAndroid Build Coastguard Worker // 304*d5c09012SAndroid Build Coastguard Worker // Declarations are organized in containers and this represents the full path 305*d5c09012SAndroid Build Coastguard Worker // to the declaration in its container, as in `google.api.expr.Decl`. 306*d5c09012SAndroid Build Coastguard Worker // 307*d5c09012SAndroid Build Coastguard Worker // Declarations used as 308*d5c09012SAndroid Build Coastguard Worker // [FunctionDecl.Overload][google.api.expr.v1alpha1.Decl.FunctionDecl.Overload] 309*d5c09012SAndroid Build Coastguard Worker // parameters may or may not have a name depending on whether the overload is 310*d5c09012SAndroid Build Coastguard Worker // function declaration or a function definition containing a result 311*d5c09012SAndroid Build Coastguard Worker // [Expr][google.api.expr.v1alpha1.Expr]. 312*d5c09012SAndroid Build Coastguard Worker string name = 1; 313*d5c09012SAndroid Build Coastguard Worker 314*d5c09012SAndroid Build Coastguard Worker // Required. The declaration kind. 315*d5c09012SAndroid Build Coastguard Worker oneof decl_kind { 316*d5c09012SAndroid Build Coastguard Worker // Identifier declaration. 317*d5c09012SAndroid Build Coastguard Worker IdentDecl ident = 2; 318*d5c09012SAndroid Build Coastguard Worker 319*d5c09012SAndroid Build Coastguard Worker // Function declaration. 320*d5c09012SAndroid Build Coastguard Worker FunctionDecl function = 3; 321*d5c09012SAndroid Build Coastguard Worker } 322*d5c09012SAndroid Build Coastguard Worker} 323*d5c09012SAndroid Build Coastguard Worker 324*d5c09012SAndroid Build Coastguard Worker// Describes a resolved reference to a declaration. 325*d5c09012SAndroid Build Coastguard Workermessage Reference { 326*d5c09012SAndroid Build Coastguard Worker // The fully qualified name of the declaration. 327*d5c09012SAndroid Build Coastguard Worker string name = 1; 328*d5c09012SAndroid Build Coastguard Worker 329*d5c09012SAndroid Build Coastguard Worker // For references to functions, this is a list of `Overload.overload_id` 330*d5c09012SAndroid Build Coastguard Worker // values which match according to typing rules. 331*d5c09012SAndroid Build Coastguard Worker // 332*d5c09012SAndroid Build Coastguard Worker // If the list has more than one element, overload resolution among the 333*d5c09012SAndroid Build Coastguard Worker // presented candidates must happen at runtime because of dynamic types. The 334*d5c09012SAndroid Build Coastguard Worker // type checker attempts to narrow down this list as much as possible. 335*d5c09012SAndroid Build Coastguard Worker // 336*d5c09012SAndroid Build Coastguard Worker // Empty if this is not a reference to a 337*d5c09012SAndroid Build Coastguard Worker // [Decl.FunctionDecl][google.api.expr.v1alpha1.Decl.FunctionDecl]. 338*d5c09012SAndroid Build Coastguard Worker repeated string overload_id = 3; 339*d5c09012SAndroid Build Coastguard Worker 340*d5c09012SAndroid Build Coastguard Worker // For references to constants, this may contain the value of the 341*d5c09012SAndroid Build Coastguard Worker // constant if known at compile time. 342*d5c09012SAndroid Build Coastguard Worker Constant value = 4; 343*d5c09012SAndroid Build Coastguard Worker} 344