Skip to content

Commit

Permalink
PUBLIC: [p4-constraints] Add missing case in quote.cc and clean up co…
Browse files Browse the repository at this point in the history
…mments.

PiperOrigin-RevId: 581403674
  • Loading branch information
PINS Team authored and Bara Kopi committed Nov 14, 2023
1 parent 18d263d commit 5ef8b74
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions p4_constraints/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ cc_library(
":constraint_source",
"//gutils:proto",
"//gutils:status",
"@com_google_absl//absl/log",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
Expand Down
2 changes: 1 addition & 1 deletion p4_constraints/ast.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ message Expression {
string integer_constant = 5;
// A table key (aka "match field"), e.g. `header.ethernet.ether_type`.
string key = 6;
// An action parameter.
// An action parameter name.
string action_parameter = 13;
Expression boolean_negation = 7;
Expression arithmetic_negation = 8;
Expand Down
9 changes: 7 additions & 2 deletions p4_constraints/quote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <sstream>
#include <string>

#include "absl/log/log.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
Expand Down Expand Up @@ -152,9 +153,13 @@ std::string GetSourceName(const ast::SourceLocation& source) {
return source.table_name();
case ast::SourceLocation::kFilePath:
return source.file_path();
default:
return "Unknown Source Type";
case ast::SourceLocation::kActionName:
return source.action_name();
case ast::SourceLocation::SOURCE_NOT_SET:
break;
}
LOG(DFATAL) << "Invalid Type: " << source.DebugString();
return "Unknown Source Type";
}

absl::StatusOr<std::string> QuoteSubConstraint(
Expand Down

0 comments on commit 5ef8b74

Please sign in to comment.