Skip to content
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
6 changes: 5 additions & 1 deletion eval/compiler/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ cc_test(
"//eval/public:builtin_func_registrar",
"//eval/public:cel_function",
"//eval/public:cel_function_registry",
"//eval/public:cel_value",
"//extensions/protobuf:ast_converters",
"//internal:casts",
"//internal:proto_matchers",
Expand Down Expand Up @@ -499,7 +500,6 @@ cc_test(
"//eval/testutil:test_message_cc_proto",
"//internal:testing",
"@com_google_absl//absl/status",
"@com_google_absl//absl/types:optional",
"@com_google_absl//absl/types:span",
"@com_google_protobuf//:protobuf",
],
Expand Down Expand Up @@ -542,16 +542,20 @@ cc_test(
":flat_expr_builder",
":flat_expr_builder_extensions",
":regex_precompilation_optimization",
":resolver",
"//common/ast:ast_impl",
"//eval/eval:evaluator_core",
"//eval/public:activation",
"//eval/public:builtin_func_registrar",
"//eval/public:cel_expression",
"//eval/public:cel_function_registry",
"//eval/public:cel_options",
"//eval/public:cel_type_registry",
"//eval/public:cel_value",
"//internal:testing",
"//parser",
"//runtime:runtime_issue",
"//runtime:runtime_options",
"//runtime/internal:issue_collector",
"//runtime/internal:runtime_env",
"//runtime/internal:runtime_env_testing",
Expand Down
4 changes: 2 additions & 2 deletions eval/compiler/constant_folding_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <memory>
#include <utility>
#include <vector>

#include "cel/expr/syntax.pb.h"
#include "absl/base/nullability.h"
Expand Down Expand Up @@ -78,8 +79,7 @@ class UpdatedConstantFoldingTest : public testing::Test {
type_registry_(env_->type_registry),
issue_collector_(RuntimeIssue::Severity::kError),
resolver_("", function_registry_, type_registry_,
type_registry_.GetComposedTypeProvider(),
type_registry_.resolveable_enums()) {}
type_registry_.GetComposedTypeProvider()) {}

protected:
absl::Nonnull<std::shared_ptr<RuntimeEnv>> env_;
Expand Down
12 changes: 6 additions & 6 deletions eval/compiler/flat_expr_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2467,12 +2467,17 @@ std::vector<ExecutionPathView> FlattenExpressionTable(

absl::StatusOr<FlatExpression> FlatExprBuilder::CreateExpressionImpl(
std::unique_ptr<Ast> ast, std::vector<RuntimeIssue>* issues) const {
if (absl::StartsWith(container_, ".") || absl::EndsWith(container_, ".")) {
return absl::InvalidArgumentError(
absl::StrCat("Invalid expression container: '", container_, "'"));
}

RuntimeIssue::Severity max_severity = options_.fail_on_warnings
? RuntimeIssue::Severity::kWarning
: RuntimeIssue::Severity::kError;
IssueCollector issue_collector(max_severity);
Resolver resolver(container_, function_registry_, type_registry_,
GetTypeProvider(), type_registry_.resolveable_enums(),
GetTypeProvider(),
options_.enable_qualified_type_identifiers);

std::shared_ptr<google::protobuf::Arena> arena;
Expand All @@ -2482,11 +2487,6 @@ absl::StatusOr<FlatExpression> FlatExprBuilder::CreateExpressionImpl(

auto& ast_impl = AstImpl::CastFromPublicAst(*ast);

if (absl::StartsWith(container_, ".") || absl::EndsWith(container_, ".")) {
return absl::InvalidArgumentError(
absl::StrCat("Invalid expression container: '", container_, "'"));
}

for (const std::unique_ptr<AstTransform>& transform : ast_transforms_) {
CEL_RETURN_IF_ERROR(transform->UpdateAst(extension_context, ast_impl));
}
Expand Down
3 changes: 3 additions & 0 deletions eval/compiler/flat_expr_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
#include <vector>

#include "absl/base/nullability.h"
#include "absl/container/flat_hash_map.h"
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include "base/ast.h"
#include "base/type_provider.h"
#include "common/value.h"
#include "eval/compiler/flat_expr_builder_extensions.h"
#include "eval/eval/evaluator_core.h"
#include "runtime/function_registry.h"
Expand Down Expand Up @@ -98,6 +100,7 @@ class FlatExprBuilder {

const absl::Nonnull<std::shared_ptr<const cel::runtime_internal::RuntimeEnv>>
env_;

cel::RuntimeOptions options_;
std::string container_;
bool enable_optional_types_ = false;
Expand Down
4 changes: 2 additions & 2 deletions eval/compiler/flat_expr_builder_extensions_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <memory>
#include <utility>
#include <vector>

#include "absl/base/nullability.h"
#include "absl/status/status.h"
Expand Down Expand Up @@ -62,8 +63,7 @@ class PlannerContextTest : public testing::Test {
type_registry_(env_->type_registry),
function_registry_(env_->function_registry),
resolver_("", function_registry_, type_registry_,
type_registry_.GetComposedTypeProvider(),
type_registry_.resolveable_enums()),
type_registry_.GetComposedTypeProvider()),
issue_collector_(RuntimeIssue::Severity::kError) {}

protected:
Expand Down
Loading