mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
some findusageability in dfa
This commit is contained in:
+2
-2
@@ -1241,7 +1241,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
if (type instanceof PsiClassType) {
|
||||
type = ((PsiClassType)type).rawType();
|
||||
}
|
||||
addInstruction(new PushInstruction(myFactory.getTypeFactory().create(type), null));
|
||||
addInstruction(new PushInstruction(myFactory.getTypeFactory().createTypeValue(type), null));
|
||||
addInstruction(new InstanceofInstruction(expression, expression.getProject(), operand, type));
|
||||
}
|
||||
else {
|
||||
@@ -1561,7 +1561,7 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
|
||||
final DfaValue dfaValue;
|
||||
if (type instanceof PsiClassType) {
|
||||
dfaValue = myFactory.getTypeFactory().create(type);
|
||||
dfaValue = myFactory.getTypeFactory().createTypeValue(type);
|
||||
}
|
||||
else {
|
||||
dfaValue = null;
|
||||
|
||||
+2
-2
@@ -278,7 +278,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
|
||||
getVariableState(var).setValue(value);
|
||||
if (value instanceof DfaNotNullValue) {
|
||||
DfaTypeValue dfaType = myFactory.getTypeFactory().create(((DfaNotNullValue)value).getType());
|
||||
DfaTypeValue dfaType = myFactory.getTypeFactory().createTypeValue(((DfaNotNullValue)value).getType());
|
||||
DfaRelationValue dfaInstanceof = myFactory.getRelationFactory().createRelation(var, dfaType, JavaTokenType.INSTANCEOF_KEYWORD, false);
|
||||
applyCondition(dfaInstanceof);
|
||||
applyCondition(compareToNull(var, true));
|
||||
@@ -791,7 +791,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
state = createVariableState(dfaVar);
|
||||
PsiType type = dfaVar.getVariableType();
|
||||
if (type != null) {
|
||||
state.setInstanceofValue(myFactory.getTypeFactory().create(type));
|
||||
state.setInstanceofValue(myFactory.getTypeFactory().createTypeValue(type));
|
||||
}
|
||||
if (isUnknownState(dfaVar)) {
|
||||
state.setNullable(false);
|
||||
|
||||
+1
-1
@@ -194,7 +194,7 @@ public class StandardInstructionVisitor extends InstructionVisitor {
|
||||
final DfaValueFactory factory = runner.getFactory();
|
||||
DfaValue dfaExpr = factory.createValue(instruction.getCasted());
|
||||
if (dfaExpr != null) {
|
||||
DfaTypeValue dfaType = factory.getTypeFactory().create(instruction.getCastTo());
|
||||
DfaTypeValue dfaType = factory.getTypeFactory().createTypeValue(instruction.getCastTo());
|
||||
DfaRelationValue dfaInstanceof = factory.getRelationFactory().createRelation(dfaExpr, dfaType, JavaTokenType.INSTANCEOF_KEYWORD, false);
|
||||
if (dfaInstanceof != null && !memState.applyInstanceofOrNull(dfaInstanceof)) {
|
||||
onInstructionProducesCCE(instruction);
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@ public class DfaTypeValue extends DfaValue {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DfaTypeValue create(@NotNull PsiType type, boolean nullable) {
|
||||
public DfaTypeValue createTypeValue(@NotNull PsiType type, boolean nullable) {
|
||||
type = TypeConversionUtil.erasure(type);
|
||||
mySharedInstance.myType = type;
|
||||
mySharedInstance.myCanonicalText = StringUtil.notNullize(type.getCanonicalText(), PsiKeyword.NULL);
|
||||
@@ -70,8 +70,8 @@ public class DfaTypeValue extends DfaValue {
|
||||
return result;
|
||||
}
|
||||
|
||||
public DfaTypeValue create(@NotNull PsiType type) {
|
||||
return create(type, false);
|
||||
public DfaTypeValue createTypeValue(@NotNull PsiType type) {
|
||||
return createTypeValue(type, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class DfaValueFactory {
|
||||
}
|
||||
|
||||
public DfaValue createTypeValueWithNullability(@Nullable PsiType type, Nullness nullability) {
|
||||
return nullability == Nullness.NOT_NULL ? getNotNullFactory().create(type) : getTypeFactory().create(type, nullability == Nullness.NULLABLE);
|
||||
return nullability == Nullness.NOT_NULL ? getNotNullFactory().create(type) : getTypeFactory().createTypeValue(type, nullability == Nullness.NULLABLE);
|
||||
}
|
||||
|
||||
int createID() {
|
||||
|
||||
Reference in New Issue
Block a user