Skip to content

Commit 4c06853

Browse files
committed
Add helper function for eval string literal operations
1 parent a865074 commit 4c06853

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
package io.ksmt.expr.rewrite.simplify
22

3+
import io.ksmt.expr.KExpr
4+
import io.ksmt.expr.KStringLiteralExpr
5+
import io.ksmt.sort.KStringSort
6+
7+
inline fun tryEvalStringLiteralOperation(
8+
lhs: KExpr<KStringSort>,
9+
rhs: KExpr<KStringSort>,
10+
operation: (KStringLiteralExpr, KStringLiteralExpr) -> KStringLiteralExpr,
11+
cont: () -> KExpr<KStringSort>
12+
): KExpr<KStringSort> = if (lhs is KStringLiteralExpr && rhs is KStringLiteralExpr) {
13+
operation(lhs, rhs)
14+
} else {
15+
cont()
16+
}

0 commit comments

Comments
 (0)