Codereview
This commit is contained in:
committed by
Space Team
parent
78b72efd32
commit
c71a2c6dd3
+2
-4
@@ -118,13 +118,13 @@ private val lateinitUsageLoweringPhase = makeWasmModulePhase(
|
||||
private val arrayConstructorReferencePhase = makeWasmModulePhase(
|
||||
::WasmArrayConstructorReferenceLowering,
|
||||
name = "ArrayConstructorReference",
|
||||
description = "Transform `::Array` into a lambda"
|
||||
description = "Transform `::Array` into a ::create#Array"
|
||||
)
|
||||
|
||||
private val arrayConstructorPhase = makeWasmModulePhase(
|
||||
::WasmArrayConstructorLowering,
|
||||
name = "ArrayConstructor",
|
||||
description = "Transform `Array(size) { index -> value }` into a loop",
|
||||
description = "Transform `Array(size) { index -> value }` into create#Array { index -> value } call",
|
||||
prerequisite = setOf(arrayConstructorReferencePhase)
|
||||
)
|
||||
|
||||
@@ -629,8 +629,6 @@ val wasmPhases = SameTypeNamedCompilerPhase(
|
||||
localClassesInInlineFunctionsPhase then
|
||||
localClassesExtractionFromInlineFunctionsPhase then
|
||||
|
||||
// TODO: Need some helpers from stdlib
|
||||
// arrayConstructorPhase then
|
||||
wrapInlineDeclarationsWithReifiedTypeParametersPhase then
|
||||
|
||||
functionInliningPhase then
|
||||
|
||||
+10
-7
@@ -141,12 +141,6 @@ internal class WasmUsefulDeclarationProcessor(
|
||||
irClass.getWasmArrayAnnotation()?.type
|
||||
?.enqueueType(irClass, "array type for wasm array annotated")
|
||||
|
||||
if (irClass.symbol in context.wasmSymbols.primitiveTypeToCreateTypedArray.keys) {
|
||||
irClass.declarations.forEach {
|
||||
(it as? IrField)?.enqueue(irClass, "preserve all fields for primitive arrays")
|
||||
}
|
||||
}
|
||||
|
||||
if (context.inlineClassesUtils.isClassInlineLike(irClass)) {
|
||||
irClass.declarations
|
||||
.firstIsInstanceOrNull<IrConstructor>()
|
||||
@@ -187,9 +181,18 @@ internal class WasmUsefulDeclarationProcessor(
|
||||
|
||||
override fun processConstructor(irConstructor: IrConstructor) {
|
||||
super.processConstructor(irConstructor)
|
||||
if (!context.inlineClassesUtils.isClassInlineLike(irConstructor.parentAsClass)) {
|
||||
val constructedClass = irConstructor.constructedClass
|
||||
if (!context.inlineClassesUtils.isClassInlineLike(constructedClass)) {
|
||||
processIrFunction(irConstructor)
|
||||
}
|
||||
|
||||
if (irConstructor.hasWasmPrimitiveConstructorAnnotation()) {
|
||||
constructedClass.declarations.forEach { declaration ->
|
||||
if (declaration is IrField) {
|
||||
declaration.enqueue(constructedClass, "preserve all fields for primitive constructors")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun isExported(declaration: IrDeclaration): Boolean = declaration.isJsExport()
|
||||
|
||||
Reference in New Issue
Block a user