Skip to content

Commit

Permalink
fuir: toStack, code simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellilltokiwa committed Jan 21, 2025
1 parent 4afda11 commit 60a42d3
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/dev/flang/fuir/GeneratingFUIR.java
Original file line number Diff line number Diff line change
Expand Up @@ -1644,13 +1644,9 @@ public boolean clazzIsUnitType(int cl)
@Override
protected void toStack(List<Object> l, Expr e, boolean dumpResult)
{
if ((e instanceof AbstractCall ||
e instanceof InlineArray ) && isConst(e))
if (isConst(e) && !dumpResult)
{
if (!dumpResult)
{
l.add(e.asCompileTimeConstant());
}
l.add(e.asCompileTimeConstant());
}
else
{
Expand All @@ -1668,9 +1664,6 @@ protected void toStack(List<Object> l, Expr e, boolean dumpResult)
*/
private boolean isConst(Object o)
{
if (PRECONDITIONS) require
(o instanceof Expr || o instanceof ExprKind);

return o instanceof InlineArray iai && isConst(iai)
|| o instanceof Constant
|| o instanceof AbstractCall ac && isConst(ac)
Expand Down Expand Up @@ -1726,7 +1719,7 @@ private boolean isConst(AbstractCall ac)
if (result)
{
var s = new List<>();
super.toStack(s, ac, false);
super.toStack(s, ac);
result = s
.stream()
.allMatch(x -> x == ac || isConst(x));
Expand Down

0 comments on commit 60a42d3

Please sign in to comment.