[JS IR] Remove redundant legacy property access property
This commit is contained in:
@@ -94,11 +94,6 @@ private fun buildRoots(modules: Iterable<IrModuleFragment>, context: JsIrBackend
|
||||
rootDeclarations += dceRuntimeDiagnostic.unreachableDeclarationMethod(context).owner
|
||||
}
|
||||
|
||||
if (context.legacyPropertyAccess) {
|
||||
rootDeclarations += context.intrinsics.safePropertyGet.owner
|
||||
rootDeclarations += context.intrinsics.safePropertySet.owner
|
||||
}
|
||||
|
||||
JsMainFunctionDetector.getMainFunctionOrNull(modules.last())?.let { mainFunction ->
|
||||
rootDeclarations += mainFunction
|
||||
if (mainFunction.isSuspend) {
|
||||
|
||||
@@ -311,10 +311,6 @@ class JsIntrinsics(private val irBuiltIns: IrBuiltIns, val context: JsIrBackendC
|
||||
val readSharedBox = getInternalFunction("sharedBoxRead")
|
||||
val writeSharedBox = getInternalFunction("sharedBoxWrite")
|
||||
|
||||
|
||||
val safePropertyGet = getInternalFunction("safePropertyGet")
|
||||
val safePropertySet = getInternalFunction("safePropertySet")
|
||||
|
||||
val jsUndefined = getInternalFunction("jsUndefined")
|
||||
|
||||
// Helpers:
|
||||
|
||||
@@ -57,7 +57,6 @@ class JsIrBackendContext(
|
||||
override val es6mode: Boolean = false,
|
||||
val dceRuntimeDiagnostic: RuntimeDiagnostic? = null,
|
||||
val propertyLazyInitialization: Boolean = false,
|
||||
val legacyPropertyAccess: Boolean = false,
|
||||
val baseClassIntoMetadata: Boolean = false,
|
||||
val safeExternalBoolean: Boolean = false,
|
||||
val safeExternalBooleanDiagnostic: RuntimeDiagnostic? = null,
|
||||
|
||||
@@ -50,7 +50,6 @@ fun compile(
|
||||
relativeRequirePath: Boolean = false,
|
||||
propertyLazyInitialization: Boolean,
|
||||
verifySignatures: Boolean = true,
|
||||
legacyPropertyAccess: Boolean = false,
|
||||
baseClassIntoMetadata: Boolean = false,
|
||||
lowerPerModule: Boolean = false,
|
||||
safeExternalBoolean: Boolean = false,
|
||||
@@ -70,7 +69,6 @@ fun compile(
|
||||
relativeRequirePath,
|
||||
propertyLazyInitialization,
|
||||
baseClassIntoMetadata,
|
||||
legacyPropertyAccess,
|
||||
safeExternalBoolean,
|
||||
safeExternalBooleanDiagnostic,
|
||||
)
|
||||
@@ -98,7 +96,6 @@ fun compile(
|
||||
es6mode = es6mode,
|
||||
dceRuntimeDiagnostic = dceRuntimeDiagnostic,
|
||||
propertyLazyInitialization = propertyLazyInitialization,
|
||||
legacyPropertyAccess = legacyPropertyAccess,
|
||||
baseClassIntoMetadata = baseClassIntoMetadata,
|
||||
safeExternalBoolean = safeExternalBoolean,
|
||||
safeExternalBooleanDiagnostic = safeExternalBooleanDiagnostic
|
||||
|
||||
@@ -132,7 +132,6 @@ fun icCompile(
|
||||
multiModule: Boolean = false,
|
||||
relativeRequirePath: Boolean = false,
|
||||
propertyLazyInitialization: Boolean,
|
||||
legacyPropertyAccess: Boolean = false,
|
||||
baseClassIntoMetadata: Boolean = false,
|
||||
safeExternalBoolean: Boolean = false,
|
||||
safeExternalBooleanDiagnostic: RuntimeDiagnostic? = null,
|
||||
@@ -150,7 +149,6 @@ fun icCompile(
|
||||
propertyLazyInitialization,
|
||||
irFactory,
|
||||
baseClassIntoMetadata,
|
||||
legacyPropertyAccess,
|
||||
safeExternalBoolean,
|
||||
safeExternalBooleanDiagnostic
|
||||
)
|
||||
@@ -215,7 +213,6 @@ private fun prepareIr(
|
||||
es6mode: Boolean = false,
|
||||
propertyLazyInitialization: Boolean,
|
||||
irFactory: PersistentIrFactory,
|
||||
legacyPropertyAccess: Boolean = false,
|
||||
baseClassIntoMetadata: Boolean = false,
|
||||
safeExternalBoolean: Boolean = false,
|
||||
safeExternalBooleanDiagnostic: RuntimeDiagnostic? = null,
|
||||
@@ -240,7 +237,6 @@ private fun prepareIr(
|
||||
es6mode = es6mode,
|
||||
dceRuntimeDiagnostic = dceRuntimeDiagnostic,
|
||||
propertyLazyInitialization = propertyLazyInitialization,
|
||||
legacyPropertyAccess = legacyPropertyAccess,
|
||||
baseClassIntoMetadata = baseClassIntoMetadata,
|
||||
safeExternalBoolean = safeExternalBoolean,
|
||||
safeExternalBooleanDiagnostic = safeExternalBooleanDiagnostic,
|
||||
|
||||
+1
-21
@@ -224,27 +224,7 @@ fun translateCall(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val defaultResult = JsInvocation(ref, listOfNotNull(jsExtensionReceiver) + arguments)
|
||||
|
||||
val alternativeResult =
|
||||
if (jsDispatchReceiver != null && jsExtensionReceiver == null && context.staticContext.backendContext.legacyPropertyAccess) {
|
||||
val property = function.correspondingPropertySymbol?.owner
|
||||
if (property != null) {
|
||||
val propertyName = context.getNameForProperty(property)
|
||||
val args = mutableListOf(jsDispatchReceiver, JsStringLiteral(symbolName.ident), JsStringLiteral(propertyName.ident))
|
||||
val fnName = when (function) {
|
||||
property.getter -> context.getNameForStaticFunction(context.staticContext.backendContext.intrinsics.safePropertyGet.owner)
|
||||
property.setter -> {
|
||||
args += arguments
|
||||
context.getNameForStaticFunction(context.staticContext.backendContext.intrinsics.safePropertySet.owner)
|
||||
}
|
||||
else -> error("Function must be an accessor of corresponding property")
|
||||
}
|
||||
JsInvocation(fnName.makeRef(), args)
|
||||
} else null
|
||||
} else null
|
||||
|
||||
alternativeResult ?: defaultResult
|
||||
JsInvocation(ref, listOfNotNull(jsExtensionReceiver) + arguments)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user