Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 bundle/src/main/java/dev/cel/bundle/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ java_library(
"//parser:macro",
"//parser:parser_builder",
"//runtime",
"//runtime:function_binding",
"@cel_spec//proto/cel/expr:checked_java_proto",
"@maven//:com_google_code_findbugs_annotations",
"@maven//:com_google_errorprone_error_prone_annotations",
Expand Down
10 changes: 5 additions & 5 deletions 10 bundle/src/main/java/dev/cel/bundle/CelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import dev.cel.compiler.CelCompilerLibrary;
import dev.cel.parser.CelMacro;
import dev.cel.parser.CelStandardMacro;
import dev.cel.runtime.CelRuntime;
import dev.cel.runtime.CelFunctionBinding;
import dev.cel.runtime.CelRuntimeLibrary;
import java.util.function.Function;

Expand Down Expand Up @@ -144,20 +144,20 @@ public interface CelBuilder {
CelBuilder addProtoTypeMasks(Iterable<ProtoTypeMask> typeMasks);

/**
* Add one or more {@link CelRuntime.CelFunctionBinding} objects to the CEL runtime.
* Add one or more {@link CelFunctionBinding} objects to the CEL runtime.
*
* <p>Functions with duplicate overload ids will be replaced in favor of the new overload.
*/
@CanIgnoreReturnValue
CelBuilder addFunctionBindings(CelRuntime.CelFunctionBinding... bindings);
CelBuilder addFunctionBindings(CelFunctionBinding... bindings);

/**
* Bind a collection of {@link CelRuntime.CelFunctionBinding} objects to the runtime.
* Bind a collection of {@link CelFunctionBinding} objects to the runtime.
*
* <p>Functions with duplicate overload ids will be replaced in favor of the new overload.
*/
@CanIgnoreReturnValue
CelBuilder addFunctionBindings(Iterable<CelRuntime.CelFunctionBinding> bindings);
CelBuilder addFunctionBindings(Iterable<CelFunctionBinding> bindings);

/** Set the expected {@code resultType} for the type-checked expression. */
@CanIgnoreReturnValue
Expand Down
4 changes: 2 additions & 2 deletions 4 bundle/src/main/java/dev/cel/bundle/CelImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ public CelBuilder addProtoTypeMasks(Iterable<ProtoTypeMask> typeMasks) {
}

@Override
public CelBuilder addFunctionBindings(CelRuntime.CelFunctionBinding... bindings) {
public CelBuilder addFunctionBindings(dev.cel.runtime.CelFunctionBinding... bindings) {
runtimeBuilder.addFunctionBindings(bindings);
return this;
}

@Override
public CelBuilder addFunctionBindings(Iterable<CelRuntime.CelFunctionBinding> bindings) {
public CelBuilder addFunctionBindings(Iterable<dev.cel.runtime.CelFunctionBinding> bindings) {
runtimeBuilder.addFunctionBindings(bindings);
return this;
}
Expand Down
1 change: 1 addition & 0 deletions 1 bundle/src/test/java/dev/cel/bundle/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ java_library(
"//runtime",
"//runtime:evaluation_exception_builder",
"//runtime:evaluation_listener",
"//runtime:function_binding",
"//runtime:unknown_attributes",
"@cel_spec//proto/cel/expr:checked_java_proto",
"@cel_spec//proto/cel/expr:syntax_java_proto",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import dev.cel.parser.CelUnparserFactory;
import dev.cel.runtime.CelEvaluationListener;
import dev.cel.runtime.CelLateFunctionBindings;
import dev.cel.runtime.CelRuntime.CelFunctionBinding;
import dev.cel.runtime.CelFunctionBinding;
import java.io.IOException;
import java.net.URL;
import java.util.Optional;
Expand Down
2 changes: 1 addition & 1 deletion 2 bundle/src/test/java/dev/cel/bundle/CelImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
import dev.cel.runtime.CelAttributePattern;
import dev.cel.runtime.CelEvaluationException;
import dev.cel.runtime.CelEvaluationExceptionBuilder;
import dev.cel.runtime.CelFunctionBinding;
import dev.cel.runtime.CelRuntime;
import dev.cel.runtime.CelRuntime.CelFunctionBinding;
import dev.cel.runtime.CelRuntime.Program;
import dev.cel.runtime.CelRuntimeFactory;
import dev.cel.runtime.CelRuntimeLegacyImpl;
Expand Down
1 change: 1 addition & 0 deletions 1 codelab/src/main/codelab/solutions/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ java_library(
"//optimizer/optimizers:constant_folding",
"//parser:macro",
"//runtime",
"//runtime:function_binding",
"//validator",
"//validator:ast_validator",
"//validator:validator_builder",
Expand Down
2 changes: 1 addition & 1 deletion 2 codelab/src/main/codelab/solutions/Exercise4.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import dev.cel.compiler.CelCompiler;
import dev.cel.compiler.CelCompilerFactory;
import dev.cel.runtime.CelEvaluationException;
import dev.cel.runtime.CelFunctionBinding;
import dev.cel.runtime.CelRuntime;
import dev.cel.runtime.CelRuntime.CelFunctionBinding;
import dev.cel.runtime.CelRuntimeFactory;
import java.util.Map;

Expand Down
1 change: 1 addition & 0 deletions 1 compiler/src/test/java/dev/cel/compiler/tools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ java_library(
"//extensions",
"//extensions:optional_library",
"//runtime",
"//runtime:function_binding",
"@cel_spec//proto/cel/expr:checked_java_proto",
"@cel_spec//proto/cel/expr/conformance/proto3:test_all_types_java_proto",
"@maven//:com_google_guava_guava",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import dev.cel.extensions.CelExtensions;
import dev.cel.extensions.CelOptionalLibrary;
import dev.cel.runtime.CelRuntime;
import dev.cel.runtime.CelRuntime.CelFunctionBinding;
import dev.cel.runtime.CelFunctionBinding;
import dev.cel.runtime.CelRuntimeFactory;
import java.net.URL;
import java.util.List;
Expand Down
6 changes: 6 additions & 0 deletions 6 extensions/src/main/java/dev/cel/extensions/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ java_library(
"//compiler:compiler_builder",
"//runtime",
"//runtime:evaluation_exception_builder",
"//runtime:function_binding",
"@maven//:com_google_errorprone_error_prone_annotations",
"@maven//:com_google_guava_guava",
],
Expand Down Expand Up @@ -77,6 +78,7 @@ java_library(
"//parser:macro",
"//parser:parser_builder",
"//runtime",
"//runtime:function_binding",
"@maven//:com_google_errorprone_error_prone_annotations",
"@maven//:com_google_guava_guava",
],
Expand Down Expand Up @@ -105,6 +107,7 @@ java_library(
"//common/types",
"//compiler:compiler_builder",
"//runtime",
"//runtime:function_binding",
"@maven//:com_google_errorprone_error_prone_annotations",
"@maven//:com_google_guava_guava",
"@maven//:com_google_protobuf_protobuf_java",
Expand All @@ -128,6 +131,7 @@ java_library(
"//parser:operator",
"//parser:parser_builder",
"//runtime",
"//runtime:function_binding",
"@maven//:com_google_guava_guava",
"@maven//:com_google_protobuf_protobuf_java",
],
Expand All @@ -147,6 +151,7 @@ java_library(
"//common/types",
"//compiler:compiler_builder",
"//runtime",
"//runtime:function_binding",
"//runtime:proto_message_runtime_equality",
"@maven//:com_google_errorprone_error_prone_annotations",
"@maven//:com_google_guava_guava",
Expand All @@ -164,6 +169,7 @@ java_library(
"//common/types",
"//compiler:compiler_builder",
"//runtime",
"//runtime:function_binding",
"@maven//:com_google_guava_guava",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import dev.cel.common.CelOverloadDecl;
import dev.cel.common.types.SimpleType;
import dev.cel.compiler.CelCompilerLibrary;
import dev.cel.runtime.CelRuntime;
import dev.cel.runtime.CelFunctionBinding;
import dev.cel.runtime.CelRuntimeBuilder;
import dev.cel.runtime.CelRuntimeLibrary;
import java.util.Base64;
Expand All @@ -45,7 +45,7 @@ enum Function {
CelOverloadDecl.newGlobalOverload(
"base64_decode_string", SimpleType.BYTES, SimpleType.STRING)),
ImmutableSet.of(
CelRuntime.CelFunctionBinding.from(
CelFunctionBinding.from(
"base64_decode_string",
String.class,
str -> ByteString.copyFrom(BASE64_DECODER.decode(str))))),
Expand All @@ -55,22 +55,20 @@ enum Function {
CelOverloadDecl.newGlobalOverload(
"base64_encode_bytes", SimpleType.STRING, SimpleType.BYTES)),
ImmutableSet.of(
CelRuntime.CelFunctionBinding.from(
CelFunctionBinding.from(
"base64_encode_bytes",
ByteString.class,
bytes -> BASE64_ENCODER.encodeToString(bytes.toByteArray())))),
;

private final CelFunctionDecl functionDecl;
private final ImmutableSet<CelRuntime.CelFunctionBinding> functionBindings;
private final ImmutableSet<CelFunctionBinding> functionBindings;

String getFunction() {
return functionDecl.name();
}

Function(
CelFunctionDecl functionDecl,
ImmutableSet<CelRuntime.CelFunctionBinding> functionBindings) {
Function(CelFunctionDecl functionDecl, ImmutableSet<CelFunctionBinding> functionBindings) {
this.functionDecl = functionDecl;
this.functionBindings = functionBindings;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
import dev.cel.common.types.SimpleType;
import dev.cel.common.types.TypeParamType;
import dev.cel.compiler.CelCompilerLibrary;
import dev.cel.runtime.CelRuntime;
import dev.cel.runtime.CelRuntime.CelFunctionBinding;
import dev.cel.runtime.CelFunctionBinding;
import dev.cel.runtime.CelRuntimeBuilder;
import dev.cel.runtime.CelRuntimeLibrary;
import java.util.Collection;
Expand Down Expand Up @@ -53,9 +52,8 @@ public enum Function {
ListType.create(SimpleType.DYN),
ListType.create(SimpleType.DYN),
SimpleType.INT)),
CelRuntime.CelFunctionBinding.from(
"list_flatten", Collection.class, list -> flatten(list, 1)),
CelRuntime.CelFunctionBinding.from(
CelFunctionBinding.from("list_flatten", Collection.class, list -> flatten(list, 1)),
CelFunctionBinding.from(
"list_flatten_list_int", Collection.class, Long.class, CelListsExtensions::flatten));

private final CelFunctionDecl functionDecl;
Expand All @@ -65,7 +63,7 @@ String getFunction() {
return functionDecl.name();
}

Function(CelFunctionDecl functionDecl, CelRuntime.CelFunctionBinding... functionBindings) {
Function(CelFunctionDecl functionDecl, CelFunctionBinding... functionBindings) {
this.functionDecl = functionDecl;
this.functionBindings = ImmutableSet.copyOf(functionBindings);
}
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.