summaryrefslogtreecommitdiff
path: root/src/passes/Print.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r--src/passes/Print.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 4fa38442c..616ce9759 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -2735,12 +2735,9 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {
}
}
void visitElementSegment(ElementSegment* curr) {
- bool allElementsRefFunc =
- std::all_of(curr->data.begin(), curr->data.end(), [](Expression* entry) {
- return entry->is<RefFunc>();
- });
+ bool usesExpressions = TableUtils::usesExpressions(curr, currModule);
auto printElemType = [&]() {
- if (allElementsRefFunc) {
+ if (!usesExpressions) {
o << "func";
} else {
printType(o, curr->type, currModule);
@@ -2758,7 +2755,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {
}
if (curr->table.is()) {
- if (!allElementsRefFunc || currModule->tables.size() > 1) {
+ if (usesExpressions || currModule->tables.size() > 1) {
// tableuse
o << " (table ";
printName(curr->table, o);
@@ -2768,7 +2765,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {
o << ' ';
visit(curr->offset);
- if (!allElementsRefFunc || currModule->tables.size() > 1) {
+ if (usesExpressions || currModule->tables.size() > 1) {
o << ' ';
printElemType();
}
@@ -2777,7 +2774,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {
printElemType();
}
- if (allElementsRefFunc) {
+ if (!usesExpressions) {
for (auto* entry : curr->data) {
auto* refFunc = entry->cast<RefFunc>();
o << ' ';