|
10 | 10 | import liquidjava.processor.context.Variable; |
11 | 11 | import liquidjava.processor.context.VariableInstance; |
12 | 12 | import liquidjava.processor.refinement_checker.TypeChecker; |
| 13 | +import liquidjava.utils.FieldNames; |
13 | 14 | import liquidjava.utils.constants.Formats; |
14 | 15 | import liquidjava.utils.constants.Keys; |
15 | 16 | import liquidjava.utils.constants.Ops; |
@@ -125,8 +126,8 @@ public <T> void getUnaryOpRefinements(CtUnaryOperator<T> operator) throws LJErro |
125 | 126 | Predicate all; |
126 | 127 | if (ex instanceof CtVariableWrite<T> w) { |
127 | 128 | name = w.getVariable().getSimpleName(); |
128 | | - if (w instanceof CtFieldWrite<?>) |
129 | | - name = String.format(Formats.THIS, name); |
| 129 | + if (w instanceof CtFieldWrite<?> fieldWrite) |
| 130 | + name = FieldNames.of(fieldWrite.getVariable()); |
130 | 131 | all = getRefinementUnaryVariableWrite(ex, operator, w, name); |
131 | 132 | rtc.checkVariableRefinements(all, name, w.getType(), operator, w.getVariable().getDeclaration()); |
132 | 133 | return; |
@@ -203,8 +204,8 @@ private Predicate getOperationRefinements(CtBinaryOperator<?> operator, CtVariab |
203 | 204 |
|
204 | 205 | if (element instanceof CtVariableRead<?> elemVar) { |
205 | 206 | String elemName = elemVar.getVariable().getSimpleName(); |
206 | | - if (elemVar instanceof CtFieldRead) |
207 | | - elemName = String.format(Formats.THIS, elemName); |
| 207 | + if (elemVar instanceof CtFieldRead<?> fieldRead) |
| 208 | + elemName = FieldNames.of(fieldRead.getVariable()); |
208 | 209 | Predicate elemRef = rtc.getContext().getVariableRefinements(elemName); |
209 | 210 |
|
210 | 211 | String returnName = elemName; |
@@ -336,8 +337,8 @@ private Predicate getCurrentVariableValue(String name) { |
336 | 337 | private Predicate getOperatorAssignmentRefinement(CtExpression<?> element) throws LJError { |
337 | 338 | if (element instanceof CtVariableRead<?> variableRead) { |
338 | 339 | String name = variableRead.getVariable().getSimpleName(); |
339 | | - if (variableRead instanceof CtFieldRead<?>) |
340 | | - name = String.format(Formats.THIS, name); |
| 340 | + if (variableRead instanceof CtFieldRead<?> fieldRead) |
| 341 | + name = FieldNames.of(fieldRead.getVariable()); |
341 | 342 | return getCurrentVariableValue(name); |
342 | 343 | } else if (element instanceof CtBinaryOperator<?> binaryOperator) { |
343 | 344 | Predicate left = getOperatorAssignmentRefinement(binaryOperator.getLeftHandOperand()); |
|
0 commit comments