Skip to content

Commit b37ad13

Browse files
jnthntatumcopybara-github
authored andcommitted
Cleanup references to ast_internal:: aliases to cel::Expr and related types.
PiperOrigin-RevId: 736136737
1 parent 5106fd6 commit b37ad13

33 files changed

+363
-394
lines changed

checker/internal/type_checker_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ absl::StatusOr<AstType> FlattenType(const Type& type) {
179179
case TypeKind::kError:
180180
return AstType(ast_internal::ErrorType());
181181
case TypeKind::kNull:
182-
return AstType(ast_internal::NullValue());
182+
return AstType(nullptr);
183183
case TypeKind::kBool:
184184
return AstType(ast_internal::PrimitiveType::kBool);
185185
case TypeKind::kInt:

checker/internal/type_checker_impl_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ INSTANTIATE_TEST_SUITE_P(
926926
::testing::Values(
927927
AstTypeConversionTestCase{
928928
.decl_type = NullType(),
929-
.expected_type = AstType(ast_internal::NullValue()),
929+
.expected_type = AstType(nullptr),
930930
},
931931
AstTypeConversionTestCase{
932932
.decl_type = DynType(),

eval/compiler/BUILD

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ cc_library(
2727
":resolver",
2828
"//base:ast",
2929
"//base:data",
30+
"//common:expr",
3031
"//common:native_type",
3132
"//common:value",
3233
"//common/ast:ast_impl",
33-
"//common/ast:expr",
3434
"//eval/eval:direct_expression_step",
3535
"//eval/eval:evaluator_core",
3636
"//eval/eval:trace_step",
@@ -59,9 +59,9 @@ cc_test(
5959
deps = [
6060
":flat_expr_builder_extensions",
6161
":resolver",
62+
"//common:expr",
6263
"//common:native_type",
6364
"//common:value",
64-
"//common/ast:expr",
6565
"//eval/eval:const_value_step",
6666
"//eval/eval:direct_expression_step",
6767
"//eval/eval:evaluator_core",
@@ -101,6 +101,7 @@ cc_library(
101101
"//common:ast",
102102
"//common:ast_traverse",
103103
"//common:ast_visitor",
104+
"//common:constant",
104105
"//common:expr",
105106
"//common:kind",
106107
"//common:type",
@@ -320,10 +321,11 @@ cc_library(
320321
":resolver",
321322
"//base:builtins",
322323
"//base:data",
324+
"//common:constant",
325+
"//common:expr",
323326
"//common:kind",
324327
"//common:value",
325328
"//common/ast:ast_impl",
326-
"//common/ast:expr",
327329
"//eval/eval:const_value_step",
328330
"//eval/eval:evaluator_core",
329331
"//internal:status_macros",
@@ -508,6 +510,7 @@ cc_library(
508510
":flat_expr_builder_extensions",
509511
"//base:builtins",
510512
"//common:casting",
513+
"//common:expr",
511514
"//common:native_type",
512515
"//common:value",
513516
"//common/ast:ast_impl",

eval/compiler/comprehension_vulnerability_check.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class ComprehensionVulnerabilityCheck : public ProgramOptimizer {
259259
}
260260

261261
absl::Status OnPostVisit(PlannerContext& context,
262-
const cel::ast_internal::Expr& node) override {
262+
const cel::Expr& node) override {
263263
return absl::OkStatus();
264264
}
265265
};

eval/compiler/constant_folding.cc

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
#include "base/builtins.h"
2828
#include "base/type_provider.h"
2929
#include "common/ast/ast_impl.h"
30-
#include "common/ast/expr.h"
30+
#include "common/constant.h"
31+
#include "common/expr.h"
3132
#include "common/kind.h"
3233
#include "common/value.h"
3334
#include "eval/compiler/flat_expr_builder_extensions.h"
@@ -45,15 +46,15 @@ namespace cel::runtime_internal {
4546

4647
namespace {
4748

49+
using ::cel::CallExpr;
50+
using ::cel::ComprehensionExpr;
51+
using ::cel::Constant;
52+
using ::cel::Expr;
53+
using ::cel::IdentExpr;
54+
using ::cel::ListExpr;
55+
using ::cel::SelectExpr;
56+
using ::cel::StructExpr;
4857
using ::cel::ast_internal::AstImpl;
49-
using ::cel::ast_internal::Call;
50-
using ::cel::ast_internal::Comprehension;
51-
using ::cel::ast_internal::Constant;
52-
using ::cel::ast_internal::CreateList;
53-
using ::cel::ast_internal::CreateStruct;
54-
using ::cel::ast_internal::Expr;
55-
using ::cel::ast_internal::Ident;
56-
using ::cel::ast_internal::Select;
5758
using ::cel::builtin::kAnd;
5859
using ::cel::builtin::kOr;
5960
using ::cel::builtin::kTernary;
@@ -117,13 +118,13 @@ absl::Status ConstantFoldingExtension::OnPreVisit(PlannerContext& context,
117118
const Expr& node) {
118119
struct IsConstVisitor {
119120
IsConst operator()(const Constant&) { return IsConst::kConditional; }
120-
IsConst operator()(const Ident&) { return IsConst::kNonConst; }
121-
IsConst operator()(const Comprehension&) {
121+
IsConst operator()(const IdentExpr&) { return IsConst::kNonConst; }
122+
IsConst operator()(const ComprehensionExpr&) {
122123
// Not yet supported, need to identify whether range and
123124
// iter vars are compatible with const folding.
124125
return IsConst::kNonConst;
125126
}
126-
IsConst operator()(const CreateStruct& create_struct) {
127+
IsConst operator()(const StructExpr& create_struct) {
127128
return IsConst::kNonConst;
128129
}
129130
IsConst operator()(const cel::MapExpr& map_expr) {
@@ -136,7 +137,7 @@ absl::Status ConstantFoldingExtension::OnPreVisit(PlannerContext& context,
136137
}
137138
return IsConst::kConditional;
138139
}
139-
IsConst operator()(const CreateList& create_list) {
140+
IsConst operator()(const ListExpr& create_list) {
140141
if (create_list.elements().empty()) {
141142
// TODO: Don't fold for empty list to allow comprehension
142143
// list append optimization.
@@ -145,13 +146,13 @@ absl::Status ConstantFoldingExtension::OnPreVisit(PlannerContext& context,
145146
return IsConst::kConditional;
146147
}
147148

148-
IsConst operator()(const Select&) { return IsConst::kConditional; }
149+
IsConst operator()(const SelectExpr&) { return IsConst::kConditional; }
149150

150151
IsConst operator()(const cel::UnspecifiedExpr&) {
151152
return IsConst::kNonConst;
152153
}
153154

154-
IsConst operator()(const Call& call) {
155+
IsConst operator()(const CallExpr& call) {
155156
// Short Circuiting operators not yet supported.
156157
if (call.function() == kAnd || call.function() == kOr ||
157158
call.function() == kTernary) {

0 commit comments

Comments
 (0)