patches from Andrey & Sergey Ignatov
This commit is contained in:
@@ -176,7 +176,8 @@ public class IntrinsicMethods {
|
|||||||
for (DeclarationDescriptor stringMember : stringMembers) {
|
for (DeclarationDescriptor stringMember : stringMembers) {
|
||||||
if (stringMember instanceof FunctionDescriptor) {
|
if (stringMember instanceof FunctionDescriptor) {
|
||||||
final FunctionDescriptor stringMethod = (FunctionDescriptor) stringMember;
|
final FunctionDescriptor stringMethod = (FunctionDescriptor) stringMember;
|
||||||
final PsiMethod[] methods = stringPsiClass.findMethodsByName(stringMember.getName(), false);
|
final PsiMethod[] methods = stringPsiClass != null?
|
||||||
|
stringPsiClass.findMethodsByName(stringMember.getName(), false) : new PsiMethod[]{};
|
||||||
for (PsiMethod method : methods) {
|
for (PsiMethod method : methods) {
|
||||||
if (method.getParameterList().getParametersCount() == stringMethod.getValueParameters().size()) {
|
if (method.getParameterList().getParametersCount() == stringMethod.getValueParameters().size()) {
|
||||||
myMethods.put(stringMethod, new PsiMethodCall(stringMethod));
|
myMethods.put(stringMethod, new PsiMethodCall(stringMethod));
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.jetbrains.jet.lang.diagnostics;
|
package org.jetbrains.jet.lang.diagnostics;
|
||||||
|
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
import com.intellij.openapi.editor.Document;
|
import com.intellij.openapi.editor.Document;
|
||||||
import com.intellij.openapi.util.TextRange;
|
import com.intellij.openapi.util.TextRange;
|
||||||
import com.intellij.openapi.vfs.VirtualFile;
|
import com.intellij.openapi.vfs.VirtualFile;
|
||||||
@@ -13,6 +14,9 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
* @author abreslav
|
* @author abreslav
|
||||||
*/
|
*/
|
||||||
public class DiagnosticUtils {
|
public class DiagnosticUtils {
|
||||||
|
private DiagnosticUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static String atLocation(@NotNull PsiElement element) {
|
public static String atLocation(@NotNull PsiElement element) {
|
||||||
return atLocation(element.getNode());
|
return atLocation(element.getNode());
|
||||||
}
|
}
|
||||||
@@ -28,10 +32,10 @@ public class DiagnosticUtils {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static PsiElement getClosestPsiElement(@NotNull ASTNode node) {
|
public static PsiElement getClosestPsiElement(@NotNull ASTNode node) {
|
||||||
while (node != null && node.getPsi() == null) {
|
while (node.getPsi() == null) {
|
||||||
node = node.getTreeParent();
|
node = node.getTreeParent();
|
||||||
}
|
}
|
||||||
return node == null ? null : node.getPsi();
|
return node.getPsi();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -84,14 +88,12 @@ public class DiagnosticUtils {
|
|||||||
|
|
||||||
public static void throwIfRunningOnServer(Throwable e) {
|
public static void throwIfRunningOnServer(Throwable e) {
|
||||||
// This is needed for the Web Demo server to log the exceptions coming from the analyzer instead of showing them in the editor.
|
// This is needed for the Web Demo server to log the exceptions coming from the analyzer instead of showing them in the editor.
|
||||||
if (System.getProperty("kotlin.running.in.server.mode", "false").equals("true")) {
|
if (System.getProperty("kotlin.running.in.server.mode", "false").equals("true") || ApplicationManager.getApplication().isUnitTestMode()) {
|
||||||
if (e instanceof RuntimeException) {
|
if (e instanceof RuntimeException) {
|
||||||
RuntimeException runtimeException = (RuntimeException) e;
|
throw (RuntimeException) e;
|
||||||
throw runtimeException;
|
|
||||||
}
|
}
|
||||||
if (e instanceof Error) {
|
if (e instanceof Error) {
|
||||||
Error error = (Error) e;
|
throw (Error) e;
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user