mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CFGBuilder: special type for temp variable (IDEA-CR-23774)
This commit is contained in:
@@ -584,7 +584,7 @@ public class CFGBuilder {
|
||||
if(type == null) {
|
||||
type = PsiType.VOID;
|
||||
}
|
||||
return new LightVariableBuilder<>("tmp$" + myAnalyzer.getInstructionCount(), type, myAnalyzer.getContext());
|
||||
return new TempVariable(myAnalyzer.getInstructionCount(), type, myAnalyzer.getContext());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -598,7 +598,19 @@ public class CFGBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether supplied variable is a temporary variable created previously via {@link #createTempVariable(PsiType)}
|
||||
*
|
||||
* @param variable to check
|
||||
* @return true if supplied variable is a temp variable.
|
||||
*/
|
||||
public static boolean isTempVariable(PsiModifierListOwner variable) {
|
||||
return variable instanceof LightVariableBuilder && ((LightVariableBuilder)variable).getName().startsWith("tmp$");
|
||||
return variable instanceof TempVariable;
|
||||
}
|
||||
|
||||
private static class TempVariable extends LightVariableBuilder<TempVariable> {
|
||||
TempVariable(int index, @NotNull PsiType type, @NotNull PsiElement navigationElement) {
|
||||
super("tmp$" + index, type, navigationElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user