Skip to content

Commit dc1f87f

Browse files
jnthntatumcopybara-github
authored andcommitted
Remove back-compatibility aliases for old names for NavigableProtoAst.
PiperOrigin-RevId: 803053260
1 parent b317f18 commit dc1f87f

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

tools/branch_coverage_test.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ TEST(BranchCoverage, IncrementsCounters) {
186186
EXPECT_TRUE(result.IsBool() && result.BoolOrDie() == true);
187187

188188
using Stats = BranchCoverage::NodeCoverageStats;
189-
const NavigableAst& ast = coverage->ast();
189+
const NavigableProtoAst& ast = coverage->ast();
190190
auto root_node_stats = coverage->StatsForNode(ast.Root().expr()->id());
191191

192192
EXPECT_THAT(root_node_stats, MatchesNodeStats(Stats{/*is_boolean=*/true,
@@ -195,7 +195,7 @@ TEST(BranchCoverage, IncrementsCounters) {
195195
/*boolean_false_count=*/0,
196196
/*error_count=*/0}));
197197

198-
const AstNode* ternary;
198+
const NavigableProtoAstNode* ternary;
199199
for (const auto& node : ast.Root().DescendantsPreorder()) {
200200
if (node.node_kind() == NodeKind::kCall &&
201201
node.expr()->call_expr().function() == cel::builtin::kTernary) {
@@ -219,7 +219,7 @@ TEST(BranchCoverage, IncrementsCounters) {
219219
/*boolean_false_count=*/0,
220220
/*error_count=*/0}));
221221

222-
const AstNode* not_arg_expr;
222+
const NavigableProtoAstNode* not_arg_expr;
223223
for (const auto& node : ast.Root().DescendantsPreorder()) {
224224
if (node.node_kind() == NodeKind::kCall &&
225225
node.expr()->call_expr().function() == cel::builtin::kNot) {
@@ -237,7 +237,7 @@ TEST(BranchCoverage, IncrementsCounters) {
237237
/*boolean_false_count=*/1,
238238
/*error_count=*/0}));
239239

240-
const AstNode* div_expr;
240+
const NavigableProtoAstNode* div_expr;
241241
for (const auto& node : ast.Root().DescendantsPreorder()) {
242242
if (node.node_kind() == NodeKind::kCall &&
243243
node.expr()->call_expr().function() == cel::builtin::kDivide) {
@@ -306,7 +306,7 @@ TEST(BranchCoverage, AccumulatesAcrossRuns) {
306306
<< result.DebugString();
307307

308308
using Stats = BranchCoverage::NodeCoverageStats;
309-
const NavigableAst& ast = coverage->ast();
309+
const NavigableProtoAst& ast = coverage->ast();
310310
auto root_node_stats = coverage->StatsForNode(ast.Root().expr()->id());
311311

312312
EXPECT_THAT(root_node_stats, MatchesNodeStats(Stats{/*is_boolean=*/true,
@@ -315,7 +315,7 @@ TEST(BranchCoverage, AccumulatesAcrossRuns) {
315315
/*boolean_false_count=*/1,
316316
/*error_count=*/0}));
317317

318-
const AstNode* ternary;
318+
const NavigableProtoAstNode* ternary;
319319
for (const auto& node : ast.Root().DescendantsPreorder()) {
320320
if (node.node_kind() == NodeKind::kCall &&
321321
node.expr()->call_expr().function() == cel::builtin::kTernary) {
@@ -378,7 +378,7 @@ TEST(BranchCoverage, CountsErrors) {
378378
EXPECT_TRUE(result.IsBool() && result.BoolOrDie() == false);
379379

380380
using Stats = BranchCoverage::NodeCoverageStats;
381-
const NavigableAst& ast = coverage->ast();
381+
const NavigableProtoAst& ast = coverage->ast();
382382
auto root_node_stats = coverage->StatsForNode(ast.Root().expr()->id());
383383

384384
EXPECT_THAT(root_node_stats, MatchesNodeStats(Stats{/*is_boolean=*/true,
@@ -387,7 +387,7 @@ TEST(BranchCoverage, CountsErrors) {
387387
/*boolean_false_count=*/1,
388388
/*error_count=*/0}));
389389

390-
const AstNode* ternary;
390+
const NavigableProtoAstNode* ternary;
391391
for (const auto& node : ast.Root().DescendantsPreorder()) {
392392
if (node.node_kind() == NodeKind::kCall &&
393393
node.expr()->call_expr().function() == cel::builtin::kTernary) {
@@ -396,7 +396,7 @@ TEST(BranchCoverage, CountsErrors) {
396396
}
397397
}
398398

399-
const AstNode* div_expr;
399+
const NavigableProtoAstNode* div_expr;
400400
for (const auto& node : ast.Root().DescendantsPreorder()) {
401401
if (node.node_kind() == NodeKind::kCall &&
402402
node.expr()->call_expr().function() == cel::builtin::kDivide) {

tools/cel_field_extractor.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ namespace cel {
2727

2828
namespace {
2929

30-
bool IsComprehensionDefinedField(const cel::AstNode& node) {
31-
const cel::AstNode* current_node = &node;
30+
bool IsComprehensionDefinedField(const cel::NavigableProtoAstNode& node) {
31+
const cel::NavigableProtoAstNode* current_node = &node;
3232

3333
while (current_node->parent() != nullptr) {
3434
current_node = current_node->parent();
@@ -57,7 +57,7 @@ bool IsComprehensionDefinedField(const cel::AstNode& node) {
5757

5858
absl::flat_hash_set<std::string> ExtractFieldPaths(
5959
const cel::expr::Expr& expr) {
60-
NavigableAst ast = NavigableAst::Build(expr);
60+
NavigableProtoAst ast = NavigableProtoAst::Build(expr);
6161

6262
absl::flat_hash_set<std::string> field_paths;
6363
std::vector<std::string> fields_in_scope;
@@ -66,7 +66,8 @@ absl::flat_hash_set<std::string> ExtractFieldPaths(
6666
// expression) always have only one operand, so its operand is visited
6767
// next in the loop iteration (which results in the path being extended,
6868
// completed, or discarded if uninteresting).
69-
for (const cel::AstNode& node : ast.Root().DescendantsPreorder()) {
69+
for (const cel::NavigableProtoAstNode& node :
70+
ast.Root().DescendantsPreorder()) {
7071
if (node.node_kind() == cel::NodeKind::kSelect) {
7172
fields_in_scope.push_back(node.expr()->select_expr().field());
7273
continue;

tools/navigable_ast.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ using ::cel::expr::Expr;
3939
using ::google::api::expr::runtime::AstTraverse;
4040
using ::google::api::expr::runtime::SourcePosition;
4141

42+
using AstNode = NavigableProtoAstNode;
4243
using NavigableAstNodeData =
4344
common_internal::NavigableAstNodeData<common_internal::ProtoAstTraits>;
4445
using NavigableAstMetadata =

tools/navigable_ast.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,6 @@ class NavigableProtoAst : public common_internal::NavigableAstBase<
164164
using Base::Base;
165165
};
166166

167-
// Type aliases for backwards compatibility.
168-
// To be removed.
169-
using AstNode = NavigableProtoAstNode;
170-
using NavigableAst = NavigableProtoAst;
171-
172167
} // namespace cel
173168

174169
#endif // THIRD_PARTY_CEL_CPP_TOOLS_NAVIGABLE_AST_H_

0 commit comments

Comments
 (0)