EA-52644 - assert: PsiUtilBase.reallyEvaluateLanguageInRange

This commit is contained in:
Alexey Kudravtsev
2014-01-17 15:10:07 +04:00
parent 070519366d
commit c803a1064c
2 changed files with 8 additions and 5 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -142,7 +142,10 @@ public class PsiUtilBase extends PsiUtilCore {
}
@Nullable
public static Language reallyEvaluateLanguageInRange(final int start, final int end, final PsiFile file) {
public static Language reallyEvaluateLanguageInRange(final int start, final int end, @NotNull PsiFile file) {
if (file instanceof PsiBinaryFile) {
return file.getLanguage();
}
Language lang = null;
int curOffset = start;
do {
@@ -170,7 +173,7 @@ public class PsiUtilBase extends PsiUtilCore {
}
@Nullable
public static Language evaluateLanguageInRange(final int start, final int end, final PsiFile file) {
public static Language evaluateLanguageInRange(final int start, final int end, @NotNull PsiFile file) {
PsiElement elt = getElementAtOffset(file, start);
TextRange selectionRange = new TextRange(start, end);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -123,7 +123,7 @@ public class BraceHighlightingHandler {
public void run() {
final PsiFile injected;
try {
injected = psiFile == null || psiFile instanceof PsiCompiledElement || isReallyDisposed(editor, project)
injected = psiFile == null || psiFile instanceof PsiCompiledElement || psiFile instanceof PsiBinaryFile || isReallyDisposed(editor, project)
? null : getInjectedFileIfAny(editor, project, offset, psiFile, alarm);
}
catch (RuntimeException e) {