mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-23 00:03:53 +02:00
Bug 530762 - Add missing evaluation types to CPPCompositesFactory.getCompositeEvaluation()
Change-Id: I9d0750d6b3d96976309567f99a03b5dc47f0a6b7
This commit is contained in:
parent
d8a9bdddb5
commit
afb3ad7511
3 changed files with 80 additions and 2 deletions
|
@ -118,6 +118,14 @@ public final class EvalConstructor extends CPPDependentEvaluation {
|
||||||
return fType;
|
return fType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICPPConstructor getConstructor() {
|
||||||
|
return fConstructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPEvaluation[] getArguments() {
|
||||||
|
return fArguments;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IValue getValue() {
|
public IValue getValue() {
|
||||||
ICPPEvaluation computed =
|
ICPPEvaluation computed =
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class EvalReference extends CPPDependentEvaluation {
|
||||||
protected IBinding referredBinding;
|
protected IBinding referredBinding;
|
||||||
protected EvalCompositeAccess referredSubValue;
|
protected EvalCompositeAccess referredSubValue;
|
||||||
|
|
||||||
EvalReference(ActivationRecord owningRecord, IBinding referredBinding, IBinding templateDefinition) {
|
public EvalReference(ActivationRecord owningRecord, IBinding referredBinding, IBinding templateDefinition) {
|
||||||
super(templateDefinition);
|
super(templateDefinition);
|
||||||
this.owningRecord = owningRecord;
|
this.owningRecord = owningRecord;
|
||||||
this.referredBinding = referredBinding;
|
this.referredBinding = referredBinding;
|
||||||
|
@ -37,7 +37,7 @@ public class EvalReference extends CPPDependentEvaluation {
|
||||||
this(owningRecord, referredBinding, findEnclosingTemplate(point));
|
this(owningRecord, referredBinding, findEnclosingTemplate(point));
|
||||||
}
|
}
|
||||||
|
|
||||||
EvalReference(ActivationRecord owningRecord, EvalCompositeAccess referredSubValue, IBinding templateDefinition) {
|
public EvalReference(ActivationRecord owningRecord, EvalCompositeAccess referredSubValue, IBinding templateDefinition) {
|
||||||
super(templateDefinition);
|
super(templateDefinition);
|
||||||
this.owningRecord = owningRecord;
|
this.owningRecord = owningRecord;
|
||||||
this.referredSubValue = referredSubValue;
|
this.referredSubValue = referredSubValue;
|
||||||
|
@ -48,6 +48,14 @@ public class EvalReference extends CPPDependentEvaluation {
|
||||||
this(owningRecord, referredSubValue, findEnclosingTemplate(point));
|
this(owningRecord, referredSubValue, findEnclosingTemplate(point));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActivationRecord getOwningRecord() {
|
||||||
|
return owningRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EvalCompositeAccess getReferredSubValue() {
|
||||||
|
return referredSubValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isInitializerList() {
|
public final boolean isInitializerList() {
|
||||||
return getTargetEvaluation().isInitializerList();
|
return getTargetEvaluation().isInitializerList();
|
||||||
|
|
|
@ -91,8 +91,10 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinary;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinaryTypeId;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinaryTypeId;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalComma;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalComma;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalCompositeAccess;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalCompoundStatementExpression;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalCompoundStatementExpression;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalConditional;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalConditional;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalConstructor;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionCall;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionCall;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionSet;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFunctionSet;
|
||||||
|
@ -101,6 +103,8 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalInitList;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalMemberAccess;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalMemberAccess;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalNaryTypeId;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalNaryTypeId;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalPackExpansion;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalPackExpansion;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalPointer;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalReference;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnary;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnary;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnaryTypeID;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnaryTypeID;
|
||||||
|
@ -340,6 +344,14 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
|
||||||
e= new EvalComma(a2, compositeTemplateDefinition);
|
e= new EvalComma(a2, compositeTemplateDefinition);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
if (eval instanceof EvalCompositeAccess) {
|
||||||
|
EvalCompositeAccess e = (EvalCompositeAccess) eval;
|
||||||
|
ICPPEvaluation a = e.getParent();
|
||||||
|
ICPPEvaluation a2 = getCompositeEvaluation(a);
|
||||||
|
if (a != a2)
|
||||||
|
e = new EvalCompositeAccess(a2, e.getElementId());
|
||||||
|
return e;
|
||||||
|
}
|
||||||
if (eval instanceof EvalCompoundStatementExpression) {
|
if (eval instanceof EvalCompoundStatementExpression) {
|
||||||
EvalCompoundStatementExpression e= (EvalCompoundStatementExpression) eval;
|
EvalCompoundStatementExpression e= (EvalCompoundStatementExpression) eval;
|
||||||
ICPPEvaluation a = e.getLastEvaluation();
|
ICPPEvaluation a = e.getLastEvaluation();
|
||||||
|
@ -360,6 +372,25 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
|
||||||
e= new EvalConditional(a2, b2, c2, e.isPositiveThrows(), e.isNegativeThrows(), compositeTemplateDefinition);
|
e= new EvalConditional(a2, b2, c2, e.isPositiveThrows(), e.isNegativeThrows(), compositeTemplateDefinition);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
if (eval instanceof EvalConstructor) {
|
||||||
|
EvalConstructor e = (EvalConstructor) eval;
|
||||||
|
IType a = e.getType();
|
||||||
|
ICPPConstructor b = e.getConstructor();
|
||||||
|
ICPPEvaluation[] c = e.getArguments();
|
||||||
|
IType a2 = getCompositeType(a);
|
||||||
|
ICPPConstructor b2 = b;
|
||||||
|
if (b instanceof IIndexFragmentBinding) {
|
||||||
|
IBinding binding = getCompositeBinding((IIndexFragmentBinding) b);
|
||||||
|
if (binding instanceof ICPPConstructor) {
|
||||||
|
b2 = (ICPPConstructor) binding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ICPPEvaluation[] c2 = getCompositeEvaluationArray(c);
|
||||||
|
if (a != a2 || b != b2 || c != c2 || templateDefinition != compositeTemplateDefinition) {
|
||||||
|
e = new EvalConstructor(a2, b2, c2, compositeTemplateDefinition);
|
||||||
|
}
|
||||||
|
return e;
|
||||||
|
}
|
||||||
if (eval instanceof EvalFixed) {
|
if (eval instanceof EvalFixed) {
|
||||||
EvalFixed e= (EvalFixed) eval;
|
EvalFixed e= (EvalFixed) eval;
|
||||||
IType a = e.getType();
|
IType a = e.getType();
|
||||||
|
@ -458,6 +489,37 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
|
||||||
e = new EvalPackExpansion(a2, compositeTemplateDefinition);
|
e = new EvalPackExpansion(a2, compositeTemplateDefinition);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
// EvalPointer is handled as a sub-case of EvalReference.
|
||||||
|
if (eval instanceof EvalReference) {
|
||||||
|
EvalReference e = (EvalReference) eval;
|
||||||
|
IBinding a = e.getReferredBinding();
|
||||||
|
// TODO: Does the ActivationRecord need conversion to composite bindings?
|
||||||
|
if (a != null) {
|
||||||
|
IBinding a2 = a;
|
||||||
|
if (a instanceof IIndexFragmentBinding) {
|
||||||
|
a2 = getCompositeBinding((IIndexFragmentBinding) a);
|
||||||
|
}
|
||||||
|
if (a != a2 || templateDefinition != compositeTemplateDefinition) {
|
||||||
|
e = new EvalReference(e.getOwningRecord(), a2, compositeTemplateDefinition);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
EvalCompositeAccess b = e.getReferredSubValue();
|
||||||
|
EvalCompositeAccess b2 = b;
|
||||||
|
ICPPEvaluation composite = getCompositeEvaluation(b2);
|
||||||
|
if (eval instanceof EvalCompositeAccess) {
|
||||||
|
b2 = (EvalCompositeAccess) composite;
|
||||||
|
}
|
||||||
|
if (b != b2 || templateDefinition != compositeTemplateDefinition) {
|
||||||
|
if (e instanceof EvalPointer) {
|
||||||
|
e = new EvalPointer(e.getOwningRecord(), b2, compositeTemplateDefinition,
|
||||||
|
((EvalPointer) e).getPosition());
|
||||||
|
} else {
|
||||||
|
e = new EvalReference(e.getOwningRecord(), b2, compositeTemplateDefinition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return e;
|
||||||
|
}
|
||||||
if (eval instanceof EvalTypeId) {
|
if (eval instanceof EvalTypeId) {
|
||||||
EvalTypeId e= (EvalTypeId) eval;
|
EvalTypeId e= (EvalTypeId) eval;
|
||||||
IType a = e.getInputType();
|
IType a = e.getInputType();
|
||||||
|
|
Loading…
Add table
Reference in a new issue