From 60a42d3d7f4c0322a1bab3a8b5ea015c6353fe20 Mon Sep 17 00:00:00 2001 From: Michael Lill Date: Tue, 21 Jan 2025 09:21:30 +0100 Subject: [PATCH] fuir: toStack, code simplifications --- src/dev/flang/fuir/GeneratingFUIR.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/dev/flang/fuir/GeneratingFUIR.java b/src/dev/flang/fuir/GeneratingFUIR.java index 118891395..417c1a1f0 100644 --- a/src/dev/flang/fuir/GeneratingFUIR.java +++ b/src/dev/flang/fuir/GeneratingFUIR.java @@ -1644,13 +1644,9 @@ public boolean clazzIsUnitType(int cl) @Override protected void toStack(List 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 { @@ -1668,9 +1664,6 @@ protected void toStack(List 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) @@ -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));