mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 01:02:48 +01:00
ast: Improve string concat readability in operator()
Provides an in-place format string to make it more pleasant to read.
This commit is contained in:
parent
5cd051eced
commit
45c5b084fd
1 changed files with 4 additions and 5 deletions
|
@ -212,16 +212,15 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const ExprPredicate& expr) {
|
void operator()(const ExprPredicate& expr) {
|
||||||
inner += "P" + std::to_string(expr.predicate);
|
inner += fmt::format("P{}", expr.predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const ExprCondCode& expr) {
|
void operator()(const ExprCondCode& expr) {
|
||||||
u32 cc = static_cast<u32>(expr.cc);
|
inner += fmt::format("CC{}", expr.cc);
|
||||||
inner += "CC" + std::to_string(cc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const ExprVar& expr) {
|
void operator()(const ExprVar& expr) {
|
||||||
inner += "V" + std::to_string(expr.var_index);
|
inner += fmt::format("V{}", expr.var_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const ExprBoolean& expr) {
|
void operator()(const ExprBoolean& expr) {
|
||||||
|
@ -229,7 +228,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const ExprGprEqual& expr) {
|
void operator()(const ExprGprEqual& expr) {
|
||||||
inner += "( gpr_" + std::to_string(expr.gpr) + " == " + std::to_string(expr.value) + ')';
|
inner += fmt::format("(gpr_{} == {})", expr.gpr, expr.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& GetResult() const {
|
const std::string& GetResult() const {
|
||||||
|
|
Loading…
Reference in a new issue