mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
explicit range check removed
This commit is contained in:
-2
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.source.tree.injected;
|
||||
|
||||
import com.intellij.openapi.util.ProperTextRange;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.LiteralTextEscaper;
|
||||
import com.intellij.psi.PsiLanguageInjectionHost;
|
||||
@@ -34,7 +33,6 @@ public class StringLiteralEscaper<T extends PsiLanguageInjectionHost> extends Li
|
||||
|
||||
@Override
|
||||
public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull StringBuilder outChars) {
|
||||
ProperTextRange.assertProperRange(rangeInsideHost);
|
||||
String subText = rangeInsideHost.substring(myHost.getText());
|
||||
outSourceOffsets = new int[subText.length()+1];
|
||||
return PsiLiteralExpressionImpl.parseStringCharacters(subText, outChars, outSourceOffsets);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.intellij.json.psi.impl;
|
||||
|
||||
import com.intellij.openapi.util.ProperTextRange;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.LiteralTextEscaper;
|
||||
@@ -15,7 +14,6 @@ public abstract class JSStringLiteralEscaper<T extends PsiLanguageInjectionHost>
|
||||
}
|
||||
|
||||
public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull StringBuilder outChars) {
|
||||
ProperTextRange.assertProperRange(rangeInsideHost);
|
||||
String subText = rangeInsideHost.substring(myHost.getText());
|
||||
|
||||
Ref<int[]> sourceOffsetsRef = new Ref<int[]>();
|
||||
|
||||
-2
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.intellij.psi.impl.source.tree.injected;
|
||||
|
||||
import com.intellij.openapi.util.ProperTextRange;
|
||||
import com.intellij.lang.CodeDocumentationAwareCommenter;
|
||||
import com.intellij.lang.Commenter;
|
||||
import com.intellij.lang.LanguageCommenters;
|
||||
@@ -35,7 +34,6 @@ public class CommentLiteralEscaper extends LiteralTextEscaper<PsiCommentImpl> {
|
||||
|
||||
@Override
|
||||
public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull StringBuilder outChars) {
|
||||
ProperTextRange.assertProperRange(rangeInsideHost);
|
||||
outChars.append(myHost.getText(), rangeInsideHost.getStartOffset(), rangeInsideHost.getEndOffset());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -746,7 +746,6 @@ public class DocumentWindowImpl extends UserDataHolderBase implements Disposable
|
||||
@Override
|
||||
@NotNull
|
||||
public ProperTextRange injectedToHost(@NotNull TextRange injected) {
|
||||
ProperTextRange.assertProperRange(injected);
|
||||
int start = injectedToHost(injected.getStartOffset(), false);
|
||||
int end = injectedToHost(injected.getEndOffset(), true);
|
||||
if (end < start) {
|
||||
|
||||
-1
@@ -146,7 +146,6 @@ public class MultiHostRegistrarImpl implements MultiHostRegistrar, ModificationT
|
||||
@NonNls @Nullable String suffix,
|
||||
@NotNull PsiLanguageInjectionHost host,
|
||||
@NotNull TextRange rangeInsideHost) {
|
||||
ProperTextRange.assertProperRange(rangeInsideHost);
|
||||
|
||||
PsiFile containingFile = PsiUtilCore.getTemplateLanguageFile(host);
|
||||
assert containingFile == myHostPsiFile : exceptionContext("Trying to inject into foreign file: "+containingFile);
|
||||
|
||||
+2
-4
@@ -15,11 +15,10 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.source.tree.injected;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.LiteralTextEscaper;
|
||||
import com.intellij.psi.impl.source.xml.XmlAttributeValueImpl;
|
||||
import com.intellij.psi.xml.XmlAttribute;
|
||||
import com.intellij.psi.LiteralTextEscaper;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.ProperTextRange;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -35,7 +34,6 @@ public class XmlAttributeLiteralEscaper extends LiteralTextEscaper<XmlAttributeV
|
||||
|
||||
@Override
|
||||
public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull StringBuilder outChars) {
|
||||
ProperTextRange.assertProperRange(rangeInsideHost);
|
||||
TextRange valueTextRange = myXmlAttribute.getValueTextRange();
|
||||
int startInDecoded = myXmlAttribute.physicalToDisplay(rangeInsideHost.getStartOffset() - valueTextRange.getStartOffset());
|
||||
int endInDecoded = myXmlAttribute.physicalToDisplay(rangeInsideHost.getEndOffset() - valueTextRange.getStartOffset());
|
||||
|
||||
+4
-6
@@ -15,13 +15,12 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.source.tree.injected;
|
||||
|
||||
import com.intellij.psi.LiteralTextEscaper;
|
||||
import com.intellij.psi.impl.source.xml.XmlCommentImpl;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.ProperTextRange;
|
||||
import com.intellij.lang.CodeDocumentationAwareCommenter;
|
||||
import com.intellij.lang.Commenter;
|
||||
import com.intellij.lang.LanguageCommenters;
|
||||
import com.intellij.lang.CodeDocumentationAwareCommenter;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.LiteralTextEscaper;
|
||||
import com.intellij.psi.impl.source.xml.XmlCommentImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -34,7 +33,6 @@ public class XmlCommentLiteralEscaper extends LiteralTextEscaper<XmlCommentImpl>
|
||||
|
||||
@Override
|
||||
public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull final StringBuilder outChars) {
|
||||
ProperTextRange.assertProperRange(rangeInsideHost);
|
||||
outChars.append(myHost.getText(), rangeInsideHost.getStartOffset(), rangeInsideHost.getEndOffset());
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-3
@@ -16,9 +16,8 @@
|
||||
package com.intellij.psi.impl.source.tree.injected;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.ProperTextRange;
|
||||
import com.intellij.psi.impl.source.xml.XmlTextImpl;
|
||||
import com.intellij.psi.LiteralTextEscaper;
|
||||
import com.intellij.psi.impl.source.xml.XmlTextImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -31,7 +30,6 @@ public class XmlTextLiteralEscaper extends LiteralTextEscaper<XmlTextImpl> {
|
||||
|
||||
@Override
|
||||
public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull StringBuilder outChars) {
|
||||
ProperTextRange.assertProperRange(rangeInsideHost);
|
||||
int startInDecoded = myHost.physicalToDisplay(rangeInsideHost.getStartOffset());
|
||||
int endInDecoded = myHost.physicalToDisplay(rangeInsideHost.getEndOffset());
|
||||
outChars.append(myHost.getValue(), startInDecoded, endInDecoded);
|
||||
|
||||
Reference in New Issue
Block a user