File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
jacodb-ets/src/main/kotlin/org/jacodb/ets/dto Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,23 @@ import org.jacodb.ets.model.EtsUnsignedRightShiftExpr
127127import org.jacodb.ets.model.EtsValue
128128import org.jacodb.ets.model.EtsVoidType
129129import org.jacodb.ets.model.EtsYieldExpr
130+ import org.jacodb.ets.utils.CONSTRUCTOR_NAME
131+
132+ /* *
133+ * Ad-hoc fix for constructor call.
134+ *
135+ * Replaces `x := x.constructor(...)` with `x.constructor(...)` call stmt.
136+ */
137+ fun EtsAssignStmt.fixConstructorCall (): EtsStmt =
138+ if (lhv is EtsLocal &&
139+ rhv is EtsInstanceCallExpr &&
140+ rhv.instance == lhv &&
141+ rhv.callee.name == CONSTRUCTOR_NAME
142+ ) {
143+ EtsCallStmt (location, rhv)
144+ } else {
145+ this
146+ }
130147
131148class EtsMethodBuilder (
132149 signature : EtsMethodSignature ,
@@ -209,7 +226,7 @@ class EtsMethodBuilder(
209226 location = loc(),
210227 lhv = lhv,
211228 rhv = rhv,
212- )
229+ ).fixConstructorCall()
213230 }
214231
215232 is CallStmtDto -> {
You can’t perform that action at this time.
0 commit comments