|
25 | 25 | import spoon.reflect.code.CtBinaryOperator; |
26 | 26 | import spoon.reflect.code.CtExpression; |
27 | 27 | import spoon.reflect.code.CtFieldRead; |
| 28 | +import spoon.reflect.code.CtFieldWrite; |
28 | 29 | import spoon.reflect.code.CtIf; |
29 | 30 | import spoon.reflect.code.CtInvocation; |
30 | 31 | import spoon.reflect.code.CtLiteral; |
|
39 | 40 | import spoon.reflect.declaration.CtClass; |
40 | 41 | import spoon.reflect.declaration.CtElement; |
41 | 42 | import spoon.reflect.declaration.CtExecutable; |
42 | | -import spoon.reflect.declaration.CtVariable; |
43 | 43 | import spoon.reflect.declaration.ParentNotInitializedException; |
44 | 44 | import spoon.reflect.reference.CtVariableReference; |
45 | 45 | import spoon.support.reflect.code.CtIfImpl; |
@@ -123,6 +123,8 @@ public <T> void getUnaryOpRefinements(CtUnaryOperator<T> operator) throws LJErro |
123 | 123 | Predicate all; |
124 | 124 | if (ex instanceof CtVariableWrite<T> w) { |
125 | 125 | name = w.getVariable().getSimpleName(); |
| 126 | + if (w instanceof CtFieldWrite<?>) |
| 127 | + name = String.format(Formats.THIS, name); |
126 | 128 | all = getRefinementUnaryVariableWrite(ex, operator, w, name); |
127 | 129 | rtc.checkVariableRefinements(all, name, w.getType(), operator, w.getVariable().getDeclaration()); |
128 | 130 | return; |
@@ -389,9 +391,8 @@ private Predicate createFreshValue(CtExpression<?> element, Predicate refinement |
389 | 391 | private <T> Predicate getRefinementUnaryVariableWrite(CtExpression<T> ex, CtUnaryOperator<T> operator, |
390 | 392 | CtVariableWrite<T> w, String name) throws LJError { |
391 | 393 | String newName = String.format(Formats.INSTANCE, name, rtc.getContext().getCounter()); |
392 | | - CtVariable<T> varDecl = w.getVariable().getDeclaration(); |
393 | 394 |
|
394 | | - Predicate metadada = rtc.getContext().getVariableRefinements(varDecl.getSimpleName()); |
| 395 | + Predicate metadada = rtc.getContext().getVariableRefinements(name); |
395 | 396 | metadada = metadada.substituteVariable(Keys.WILDCARD, newName); |
396 | 397 | metadada = metadada.substituteVariable(name, newName); |
397 | 398 |
|
|
0 commit comments