Replace all throw error(...) with just error(...)

`throw` is not needed in this case, because `error(...)` already
  raises exception (so `throw` is unreachable). Also after previous
  commit compiler reports `UNREACHABLE_CODE` warning on such `throw`
This commit is contained in:
Dmitriy Novozhilov
2021-07-02 12:42:19 +03:00
committed by TeamCityServer
parent ae608ea67f
commit 3f5e6a79c7
6 changed files with 8 additions and 8 deletions

View File

@@ -292,7 +292,7 @@ private object DiagnoseUnknownModuleInfoReporter {
else -> errorInModulesResolver(message)
}
}
else -> throw errorInModulesResolver(message)
else -> errorInModulesResolver(message)
}
}
name.contains(ResolverForProject.resolverForScriptDependenciesName) -> errorInScriptDependenciesInfoResolver(message)

View File

@@ -134,7 +134,7 @@ fun validateIsExternal(packageFragment: IrPackageFragment) {
fun validateNestedExternalDeclarations(declaration: IrDeclaration, isExternalTopLevel: Boolean) {
fun IrPossiblyExternalDeclaration.checkExternal() {
if (isExternal != isExternalTopLevel) {
throw error("isExternal validation failed for declaration ${declaration.render()}")
error("isExternal validation failed for declaration ${declaration.render()}")
}
}

View File

@@ -190,7 +190,7 @@ open class KtFile(viewProvider: FileViewProvider, val isCompiled: Boolean) :
return stub
}
throw error("Illegal stub for KtFile: type=${this.javaClass}, stub=${stub?.javaClass} name=$name")
error("Illegal stub for KtFile: type=${this.javaClass}, stub=${stub?.javaClass} name=$name")
}
override fun getClasses(): Array<PsiClass> {

View File

@@ -143,7 +143,7 @@ private class JsonParser(val content: String) {
fun parse(): JsonNode {
val result = parseNode()
skipSpaces()
if (charCode != -1) throw error("End of input expected")
if (charCode != -1) error("End of input expected")
return result
}

View File

@@ -59,7 +59,7 @@ fun findLastVersions(packages: List<PackageInformation>): List<Package> {
.filter { it.preRelease == null && it.build == null }
.maxOrNull()
?.toString()
?: throw error("There is no applicable version for ${packageInformation.name}")
?: error("There is no applicable version for ${packageInformation.name}")
is HardcodedPackageInformation -> packageInformation.version
}
@@ -69,4 +69,4 @@ fun findLastVersions(packages: List<PackageInformation>): List<Package> {
packageInformation.displayName
)
}
}
}

View File

@@ -33,7 +33,7 @@ data class KotlinWebpackCssSupport(
}
private fun singleRuleError(): Nothing {
throw error("CSS mode shortcut can be applied only with one css rule")
error("CSS mode shortcut can be applied only with one css rule")
}
}
@@ -52,4 +52,4 @@ object KotlinWebpackCssMode {
const val EXTRACT = "extract"
const val INLINE = "inline"
const val IMPORT = "import"
}
}