Removed useless method.
This commit is contained in:
@@ -28,7 +28,6 @@ import org.jetbrains.jet.lang.cfg.pseudocode.Pseudocode;
|
|||||||
import org.jetbrains.jet.lang.cfg.pseudocode.PseudocodeImpl;
|
import org.jetbrains.jet.lang.cfg.pseudocode.PseudocodeImpl;
|
||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
|
||||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||||
import org.jetbrains.jet.lang.resolve.constants.BooleanValue;
|
import org.jetbrains.jet.lang.resolve.constants.BooleanValue;
|
||||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstantResolver;
|
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstantResolver;
|
||||||
@@ -569,7 +568,7 @@ public class JetControlFlowProcessor {
|
|||||||
if (labelName != null) {
|
if (labelName != null) {
|
||||||
JetSimpleNameExpression targetLabel = expression.getTargetLabel();
|
JetSimpleNameExpression targetLabel = expression.getTargetLabel();
|
||||||
assert targetLabel != null;
|
assert targetLabel != null;
|
||||||
PsiElement labeledElement = BindingContextUtils.resolveToDeclarationPsiElement(trace.getBindingContext(), targetLabel);
|
PsiElement labeledElement = trace.get(BindingContext.LABEL_TARGET, targetLabel);
|
||||||
if (labeledElement instanceof JetLoopExpression) {
|
if (labeledElement instanceof JetLoopExpression) {
|
||||||
loop = (JetLoopExpression) labeledElement;
|
loop = (JetLoopExpression) labeledElement;
|
||||||
}
|
}
|
||||||
@@ -598,7 +597,7 @@ public class JetControlFlowProcessor {
|
|||||||
String labelName = expression.getLabelName();
|
String labelName = expression.getLabelName();
|
||||||
if (labelElement != null) {
|
if (labelElement != null) {
|
||||||
assert labelName != null;
|
assert labelName != null;
|
||||||
PsiElement labeledElement = BindingContextUtils.resolveToDeclarationPsiElement(trace.getBindingContext(), labelElement);
|
PsiElement labeledElement = trace.get(BindingContext.LABEL_TARGET, labelElement);
|
||||||
if (labeledElement != null) {
|
if (labeledElement != null) {
|
||||||
assert labeledElement instanceof JetElement;
|
assert labeledElement instanceof JetElement;
|
||||||
subroutine = (JetElement) labeledElement;
|
subroutine = (JetElement) labeledElement;
|
||||||
|
|||||||
@@ -68,21 +68,6 @@ public class BindingContextUtils {
|
|||||||
/*package*/ static final ReadOnlySlice<DeclarationDescriptor, PsiElement> DESCRIPTOR_TO_DECLARATION =
|
/*package*/ static final ReadOnlySlice<DeclarationDescriptor, PsiElement> DESCRIPTOR_TO_DECLARATION =
|
||||||
Slices.<DeclarationDescriptor, PsiElement>sliceBuilder().setKeyNormalizer(DECLARATION_DESCRIPTOR_NORMALIZER).setDebugName("DESCRIPTOR_TO_DECLARATION").build();
|
Slices.<DeclarationDescriptor, PsiElement>sliceBuilder().setKeyNormalizer(DECLARATION_DESCRIPTOR_NORMALIZER).setDebugName("DESCRIPTOR_TO_DECLARATION").build();
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public static PsiElement resolveToDeclarationPsiElement(@NotNull BindingContext bindingContext, @Nullable JetReferenceExpression referenceExpression) {
|
|
||||||
DeclarationDescriptor declarationDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, referenceExpression);
|
|
||||||
if (declarationDescriptor == null) {
|
|
||||||
return bindingContext.get(BindingContext.LABEL_TARGET, referenceExpression);
|
|
||||||
}
|
|
||||||
|
|
||||||
PsiElement element = descriptorToDeclaration(bindingContext, declarationDescriptor);
|
|
||||||
if (element != null) {
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static VariableDescriptor extractVariableDescriptorIfAny(@NotNull BindingContext bindingContext, @Nullable JetElement element, boolean onlyReference) {
|
public static VariableDescriptor extractVariableDescriptorIfAny(@NotNull BindingContext bindingContext, @Nullable JetElement element, boolean onlyReference) {
|
||||||
DeclarationDescriptor descriptor = null;
|
DeclarationDescriptor descriptor = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user