mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Bug 501623 - ClassCastException in EvalMemberAccess.getValue
Change-Id: Ib9177f2bd2f9d9d005397b72d6d0274cb3e2605f
This commit is contained in:
parent
ee1d72c7f8
commit
898ce2245b
1 changed files with 10 additions and 6 deletions
|
@ -23,8 +23,6 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
|
|||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateTypeUptoPointers;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||
|
@ -58,6 +56,8 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics.LookupMode;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class EvalMemberAccess extends CPPDependentEvaluation {
|
||||
private final IType fOwnerType;
|
||||
private final IBinding fMember;
|
||||
|
@ -300,14 +300,18 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
|
|||
public IValue getValue(IASTNode point) {
|
||||
if (fOwnerEval != null) {
|
||||
int fieldPos = CPPASTFieldReference.getFieldPosition(fMember, fOwnerType);
|
||||
CompositeValue compValue = (CompositeValue) fOwnerEval.getValue(point);
|
||||
ICPPEvaluation field = compValue.getSubValue(fieldPos);
|
||||
if(field != null) {
|
||||
return field.getValue(point);
|
||||
IValue ownerValue = fOwnerEval.getValue(point);
|
||||
if (ownerValue instanceof CompositeValue) {
|
||||
CompositeValue compValue = (CompositeValue) ownerValue;
|
||||
ICPPEvaluation field = compValue.getSubValue(fieldPos);
|
||||
if (field != null) {
|
||||
return field.getValue(point);
|
||||
}
|
||||
} else {
|
||||
return IntegralValue.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
if (fMember instanceof IEnumerator) {
|
||||
return ((IEnumerator) fMember).getValue();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue