Fix name retrieval on exception reporting during analysis
This commit is contained in:
committed by
Alexander Udalov
parent
135f0a136e
commit
4178188e15
@@ -35,11 +35,10 @@ public class KtScript extends KtNamedDeclarationStub<KotlinScriptStub> implement
|
||||
// make it a simple lazy value after converting to kotlin
|
||||
private KotlinScriptDefinition getKotlinScriptDefinition() {
|
||||
if (!kotlinScriptDefinitionInitialized) {
|
||||
KtFile ktFile = getContainingKtFile();
|
||||
kotlinScriptDefinitionField = KotlinScriptDefinitionProviderKt.getScriptDefinition(ktFile);
|
||||
kotlinScriptDefinitionField = KotlinScriptDefinitionProviderKt.getScriptDefinition(getContainingKtFile());
|
||||
kotlinScriptDefinitionInitialized = true;
|
||||
assert kotlinScriptDefinitionField != null : "Should not parse a script without definition: " + ktFile.toString();
|
||||
}
|
||||
assert kotlinScriptDefinitionField != null : "Should not parse a script without definition: " + getContainingKtFile().toString();
|
||||
return kotlinScriptDefinitionField;
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -38,7 +38,13 @@ class ExceptionWrappingKtVisitorVoid(private val delegate: KtVisitorVoid) : KtVi
|
||||
throw e
|
||||
}
|
||||
catch (t: Throwable) {
|
||||
throw KotlinFrontEndException("Failed to analyze declaration ${dcl.name}", t, dcl)
|
||||
val name = try {
|
||||
dcl.name
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
"- error: ${e.message}"
|
||||
}
|
||||
throw KotlinFrontEndException("Failed to analyze declaration $name", t, dcl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user