mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
decrease the invocation counts of psi.getText in several java places
This commit is contained in:
+11
-11
@@ -16,7 +16,6 @@
|
||||
package com.intellij.psi.impl.source.tree.java;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightUtilCore;
|
||||
import com.intellij.extapi.psi.StubBasedPsiElementBase;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
@@ -120,6 +119,17 @@ public class PsiLiteralExpressionImpl
|
||||
@Override
|
||||
public Object getValue() {
|
||||
final IElementType type = getLiteralElementType();
|
||||
if (type == JavaTokenType.TRUE_KEYWORD) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if (type == JavaTokenType.FALSE_KEYWORD) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
if (type == JavaTokenType.STRING_LITERAL) {
|
||||
String innerText = getInnerText();
|
||||
return innerText == null ? null : internedParseStringCharacters(innerText);
|
||||
}
|
||||
|
||||
String text = NUMERIC_LITERALS.contains(type) ? getCanonicalText().toLowerCase(Locale.ENGLISH) : getCanonicalText();
|
||||
final int textLength = text.length();
|
||||
|
||||
@@ -201,16 +211,6 @@ public class PsiLiteralExpressionImpl
|
||||
if (chars.length() != 1) return null;
|
||||
return Character.valueOf(chars.charAt(0));
|
||||
}
|
||||
if (type == JavaTokenType.STRING_LITERAL) {
|
||||
String innerText = getInnerText();
|
||||
return innerText == null ? null : internedParseStringCharacters(innerText);
|
||||
}
|
||||
if (type == JavaTokenType.TRUE_KEYWORD) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if (type == JavaTokenType.FALSE_KEYWORD) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user