[JS IR] Add test with boolean in external interface

[JS IR] Add possibility to safely access Boolean in external declaration

[JS IR] Add diagnostic for booleans in externals
This commit is contained in:
Ilya Goncharov
2021-06-15 20:18:30 +03:00
committed by Space
parent 2e049c1208
commit 21a3494bca
20 changed files with 293 additions and 69 deletions
@@ -127,7 +127,7 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(
value = "-Xir-dce-runtime-diagnostic",
valueDescription = "{$DCE_RUNTIME_DIAGNOSTIC_LOG|$DCE_RUNTIME_DIAGNOSTIC_EXCEPTION}",
valueDescription = "{$RUNTIME_DIAGNOSTIC_LOG|$RUNTIME_DIAGNOSTIC_EXCEPTION}",
description = "Enable runtime diagnostics when performing DCE instead of removing declarations"
)
var irDceRuntimeDiagnostic: String? by NullableStringFreezableVar(null)
@@ -157,6 +157,19 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xir-base-class-in-metadata", description = "Write base class into metadata")
var irBaseClassInMetadata: Boolean by FreezableVar(false)
@Argument(
value = "-Xir-safe-external-boolean",
description = "Safe access via Boolean() to Boolean properties in externals to safely cast falsy values."
)
var irSafeExternalBoolean: Boolean by FreezableVar(false)
@Argument(
value = "-Xir-safe-external-boolean-diagnostic",
valueDescription = "{$RUNTIME_DIAGNOSTIC_LOG|$RUNTIME_DIAGNOSTIC_EXCEPTION}",
description = "Enable runtime diagnostics when access safely to boolean in external declarations"
)
var irSafeExternalBooleanDiagnostic: String? by NullableStringFreezableVar(null)
@Argument(value = "-Xir-per-module", description = "Splits generated .js per-module")
var irPerModule: Boolean by FreezableVar(false)
@@ -29,6 +29,6 @@ public interface K2JsArgumentConstants {
String SOURCE_MAP_SOURCE_CONTENT_NEVER = "never";
String SOURCE_MAP_SOURCE_CONTENT_INLINING = "inlining";
String DCE_RUNTIME_DIAGNOSTIC_LOG = "log";
String DCE_RUNTIME_DIAGNOSTIC_EXCEPTION = "exception";
String RUNTIME_DIAGNOSTIC_LOG = "log";
String RUNTIME_DIAGNOSTIC_EXCEPTION = "exception";
}