Skip to content

Commit

Permalink
ConstantValue: Correctly propagate new optional args
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsc96 committed Nov 4, 2022
1 parent 9852b64 commit 62f58a6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions source/numeric/ConstantValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ std::string ConstantValue::toString(bitwidth_t abbreviateThresholdBits, bool exa
FormatBuffer buffer;
buffer.append(useAssignmentPatterns ? "'{"sv : "["sv);
for (auto& element : arg) {
buffer.append(element.toString(abbreviateThresholdBits));
buffer.append(element.toString(abbreviateThresholdBits, exactUnknowns, useAssignmentPatterns));
buffer.append(",");
}

Expand All @@ -55,12 +55,12 @@ std::string ConstantValue::toString(bitwidth_t abbreviateThresholdBits, bool exa
FormatBuffer buffer;
buffer.append(useAssignmentPatterns ? "'{"sv : "["sv);
for (auto& [key, val] : *arg)
buffer.format("{}:{},", key.toString(abbreviateThresholdBits),
val.toString(abbreviateThresholdBits));
buffer.format("{}:{},", key.toString(abbreviateThresholdBits, exactUnknowns, useAssignmentPatterns),
val.toString(abbreviateThresholdBits, exactUnknowns, useAssignmentPatterns));

if (arg->defaultValue)
buffer.format("default:{}",
arg->defaultValue.toString(abbreviateThresholdBits));
buffer.format("default:{}", arg->defaultValue.toString(abbreviateThresholdBits,
exactUnknowns, useAssignmentPatterns));
else if (!arg->empty())
buffer.pop_back();

Expand All @@ -71,7 +71,7 @@ std::string ConstantValue::toString(bitwidth_t abbreviateThresholdBits, bool exa
FormatBuffer buffer;
buffer.append(useAssignmentPatterns ? "'{"sv : "["sv);
for (auto& element : *arg) {
buffer.append(element.toString(abbreviateThresholdBits));
buffer.append(element.toString(abbreviateThresholdBits, exactUnknowns, useAssignmentPatterns));
buffer.append(",");
}

Expand All @@ -84,7 +84,8 @@ std::string ConstantValue::toString(bitwidth_t abbreviateThresholdBits, bool exa
if (!arg->activeMember)
return "(unset)"s;

return fmt::format("({}) {}", *arg->activeMember, arg->value.toString(abbreviateThresholdBits));
return fmt::format("({}) {}", *arg->activeMember,
arg->value.toString(abbreviateThresholdBits, exactUnknowns, useAssignmentPatterns));
}
else {
static_assert(always_false<T>::value, "Missing case");
Expand Down

0 comments on commit 62f58a6

Please sign in to comment.