Add getSignificantElement method in JetCodeFragment
This commit is contained in:
@@ -254,11 +254,7 @@ fun addDebugExpressionBeforeContextElement(codeFragment: JetCodeFragment, contex
|
||||
|
||||
parent.addBefore(JetPsiFactory.createNewLine(contextElement.getProject()), contextElement)
|
||||
|
||||
val debugExpression = when(codeFragment) {
|
||||
is JetExpressionCodeFragment -> codeFragment.getExpression()
|
||||
is JetBlockCodeFragment -> codeFragment.getBlock()
|
||||
else -> null
|
||||
}
|
||||
val debugExpression = codeFragment.getSignificantElement()
|
||||
if (debugExpression == null) return null
|
||||
|
||||
val newDebugExpression = parent.addBefore(debugExpression, contextElement)
|
||||
|
||||
@@ -218,14 +218,8 @@ public class ResolveElementCache {
|
||||
JetCodeFragment codeFragment,
|
||||
BindingTrace trace
|
||||
) {
|
||||
JetExpression codeFragmentExpression = null;
|
||||
if (codeFragment instanceof JetExpressionCodeFragment) {
|
||||
codeFragmentExpression = ((JetExpressionCodeFragment) codeFragment).getExpression();
|
||||
}
|
||||
else if (codeFragment instanceof JetBlockCodeFragment) {
|
||||
codeFragmentExpression = ((JetBlockCodeFragment) codeFragment).getBlock();
|
||||
}
|
||||
if (codeFragmentExpression == null) return;
|
||||
JetElement codeFragmentExpression = codeFragment.getSignificantElement();
|
||||
if (!(codeFragmentExpression instanceof JetExpression)) return;
|
||||
|
||||
PsiElement contextElement = codeFragment.getContext();
|
||||
if (!(contextElement instanceof JetExpression)) return;
|
||||
@@ -245,7 +239,7 @@ public class ResolveElementCache {
|
||||
|
||||
DataFlowInfo dataFlowInfoForContextElement = contextForElement.get(BindingContext.EXPRESSION_DATA_FLOW_INFO, contextExpression);
|
||||
AnalyzerPackage.computeTypeInContext(
|
||||
codeFragmentExpression,
|
||||
(JetExpression) codeFragmentExpression,
|
||||
chainedScope,
|
||||
trace,
|
||||
dataFlowInfoForContextElement == null ? DataFlowInfo.EMPTY : dataFlowInfoForContextElement,
|
||||
|
||||
Reference in New Issue
Block a user