mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +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.TDEF;
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateTypeUptoPointers;
|
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.IASTExpression.ValueCategory;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
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.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics.LookupMode;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public class EvalMemberAccess extends CPPDependentEvaluation {
|
public class EvalMemberAccess extends CPPDependentEvaluation {
|
||||||
private final IType fOwnerType;
|
private final IType fOwnerType;
|
||||||
private final IBinding fMember;
|
private final IBinding fMember;
|
||||||
|
@ -300,14 +300,18 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
|
||||||
public IValue getValue(IASTNode point) {
|
public IValue getValue(IASTNode point) {
|
||||||
if (fOwnerEval != null) {
|
if (fOwnerEval != null) {
|
||||||
int fieldPos = CPPASTFieldReference.getFieldPosition(fMember, fOwnerType);
|
int fieldPos = CPPASTFieldReference.getFieldPosition(fMember, fOwnerType);
|
||||||
CompositeValue compValue = (CompositeValue) fOwnerEval.getValue(point);
|
IValue ownerValue = fOwnerEval.getValue(point);
|
||||||
ICPPEvaluation field = compValue.getSubValue(fieldPos);
|
if (ownerValue instanceof CompositeValue) {
|
||||||
if(field != null) {
|
CompositeValue compValue = (CompositeValue) ownerValue;
|
||||||
return field.getValue(point);
|
ICPPEvaluation field = compValue.getSubValue(fieldPos);
|
||||||
|
if (field != null) {
|
||||||
|
return field.getValue(point);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return IntegralValue.UNKNOWN;
|
return IntegralValue.UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fMember instanceof IEnumerator) {
|
if (fMember instanceof IEnumerator) {
|
||||||
return ((IEnumerator) fMember).getValue();
|
return ((IEnumerator) fMember).getValue();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue