Skip to content

Commit

Permalink
Move function def to expression.def.
Browse files Browse the repository at this point in the history
  • Loading branch information
kfcripps committed Jan 25, 2024
1 parent ef316f3 commit 078aaf4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
13 changes: 0 additions & 13 deletions ir/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,3 @@ IR::Constant IR::Constant::operator-() const { return IR::Constant(-value); }
IR::Constant IR::Constant::GetMask(unsigned width) {
return (IR::Constant(1) << width) - IR::Constant(1);
}

cstring IR::StructExpression::toString() const {
cstring str = "{";
if (!components.empty()) {
cstring exprStr = components.at(0)->expression->toString();
str += " " + components.at(0)->toString() + " = " + exprStr;
}
for (unsigned i = 1; i < size(); i++) {
cstring exprStr = components.at(i)->expression->toString();
str += ", " + components.at(i)->toString() + " = " + exprStr;
}
return str + " }";
}
13 changes: 12 additions & 1 deletion ir/expression.def
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,18 @@ class StructExpression : Expression {
size_t size = components.size();
return components.at(size - 1)->is<IR::NamedDots>();
}
cstring toString() const;
toString {
cstring str = "{";
if (!components.empty()) {
cstring exprStr = components.at(0)->expression->toString();
str += " " + components.at(0)->toString() + " = " + exprStr;
}
for (unsigned i = 1; i < size(); i++) {
cstring exprStr = components.at(i)->expression->toString();
str += ", " + components.at(i)->toString() + " = " + exprStr;
}
return str + " }";
}
}

/// Can be an invalid header or header_union
Expand Down

0 comments on commit 078aaf4

Please sign in to comment.