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
127
127
import org.jacodb.ets.model.EtsValue
128
128
import org.jacodb.ets.model.EtsVoidType
129
129
import 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
+ }
130
147
131
148
class EtsMethodBuilder (
132
149
signature : EtsMethodSignature ,
@@ -209,7 +226,7 @@ class EtsMethodBuilder(
209
226
location = loc(),
210
227
lhv = lhv,
211
228
rhv = rhv,
212
- )
229
+ ).fixConstructorCall()
213
230
}
214
231
215
232
is CallStmtDto -> {
You can’t perform that action at this time.
0 commit comments