a little warning cleanup

This commit is contained in:
Alexander Gorshenev
2017-04-14 00:40:27 +03:00
committed by alexander-gorshenev
parent ce85975fac
commit f959c4e43c
6 changed files with 8 additions and 9 deletions
@@ -92,7 +92,7 @@ public fun runTopLevelPhases(konanConfig: KonanConfig, environment: KotlinCoreEn
markBackingFields(context) markBackingFields(context)
val serializer = KonanSerializationUtil(context) val serializer = KonanSerializationUtil(context)
context.serializedLinkData = context.serializedLinkData =
serializer.serializeModule(context.moduleDescriptor!!) serializer.serializeModule(context.moduleDescriptor)
DeserializerDriver(context).dumpAllInlineBodies() DeserializerDriver(context).dumpAllInlineBodies()
} }
phaser.phase(KonanPhase.BACKEND) { phaser.phase(KonanPhase.BACKEND) {
@@ -33,7 +33,7 @@ open class DeepVisitor<D>(val worker: DeclarationDescriptorVisitor<Boolean, D>)
open fun visitChildren(descriptor: DeclarationDescriptor?, data: D): Boolean { open fun visitChildren(descriptor: DeclarationDescriptor?, data: D): Boolean {
if (descriptor == null) return true if (descriptor == null) return true
return descriptor!!.accept(this, data) return descriptor.accept(this, data)
} }
fun applyWorker(descriptor: DeclarationDescriptor, data: D): Boolean { fun applyWorker(descriptor: DeclarationDescriptor, data: D): Boolean {
@@ -31,7 +31,6 @@ fun loadMetadata(configuration: CompilerConfiguration, file: File): ModuleDescri
val reader = MetadataReader(file) val reader = MetadataReader(file)
var metadataAsString: String? = null
var moduleName: String? = null var moduleName: String? = null
val currentAbiVersion = configuration.get(KonanConfigKeys.ABI_VERSION) val currentAbiVersion = configuration.get(KonanConfigKeys.ABI_VERSION)
@@ -57,7 +56,7 @@ fun loadMetadata(configuration: CompilerConfiguration, file: File): ModuleDescri
val tableOfContentsAsString = reader.string(dataNode) val tableOfContentsAsString = reader.string(dataNode)
val moduleDescriptor = val moduleDescriptor =
deserializeModule(configuration, {it->loadPackageFragment(reader, it)}, tableOfContentsAsString!!, moduleName!!) deserializeModule(configuration, {it->loadPackageFragment(reader, it)}, tableOfContentsAsString, moduleName)
return moduleDescriptor return moduleDescriptor
} }
@@ -414,7 +414,7 @@ internal class IrDescriptorDeserializer(val context: Context,
// Special case: for invoke we need to re-synthesize // Special case: for invoke we need to re-synthesize
// the invoke() descriptor. // the invoke() descriptor.
val invoke = functions.singleOrNull { val invoke = functions.singleOrNull {
(it as FunctionDescriptor).isFunctionInvoke ?: false (it as FunctionDescriptor).isFunctionInvoke
} }
if (invoke != null) if (invoke != null)
@@ -772,7 +772,7 @@ internal class IrDeserializer(val context: Context,
val arguments = mutableListOf<IrExpression>() val arguments = mutableListOf<IrExpression>()
argumentProtos.forEach { argumentProtos.forEach {
arguments.add(deserializeExpression(it) as IrExpression) arguments.add(deserializeExpression(it))
} }
return IrStringConcatenationImpl(start, end, type, arguments) return IrStringConcatenationImpl(start, end, type, arguments)
} }
@@ -974,7 +974,7 @@ internal class IrDeserializer(val context: Context,
val body = deserializeStatement(proto.getBody()) val body = deserializeStatement(proto.getBody())
val function = IrFunctionImpl(start, end, origin, val function = IrFunctionImpl(start, end, origin,
descriptor as FunctionDescriptor, body as IrBody) descriptor, body as IrBody)
proto.defaultArgumentList.forEach { proto.defaultArgumentList.forEach {
val expr = deserializeExpression(it.value) val expr = deserializeExpression(it.value)
@@ -1068,7 +1068,7 @@ internal class IrDeserializer(val context: Context,
} }
fun decodeDeclaration(): IrDeclaration { fun decodeDeclaration(): IrDeclaration {
val proto = (rootFunction as DeserializedSimpleFunctionDescriptor).proto val proto = rootFunction.proto
if (!proto.hasExtension(KonanLinkData.inlineIrBody)) { if (!proto.hasExtension(KonanLinkData.inlineIrBody)) {
throw KonanIrDeserializationException("$rootFunction doesn't have ir serialized.") throw KonanIrDeserializationException("$rootFunction doesn't have ir serialized.")
@@ -67,7 +67,7 @@ internal class DeserializerDriver(val context: Context) {
internal fun dumpAllInlineBodies() { internal fun dumpAllInlineBodies() {
if (! context.phase!!.verbose) return if (! context.phase!!.verbose) return
context.log("Now deserializing all inlines for debugging purpose.") context.log("Now deserializing all inlines for debugging purpose.")
context.moduleDescriptor!!.accept( context.moduleDescriptor.accept(
InlineBodiesPrinterVisitor(InlineBodyPrinter()), Unit) InlineBodiesPrinterVisitor(InlineBodyPrinter()), Unit)
} }