-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JS IR] Use a backing field initializer for js() code folding
During a translation of the code from js() call to statement list, the compiler folds the code string. For that it uses property bodies. However the bodies can not be loaded in an incremental rebuild. The patch uses the backing field initializers of constant properties. The initializers are always loaded. ^KT-57002 Fixed (cherry picked from commit f82d3e6)
- Loading branch information
Showing
20 changed files
with
130 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
js/js.tests/tests-gen/org/jetbrains/kotlin/incremental/JsIrES6InvalidationTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
js/js.tests/tests-gen/org/jetbrains/kotlin/incremental/JsIrInvalidationTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ STEP 0: | |
added file: l2.kt | ||
STEP 1: | ||
dependencies: lib1 | ||
updated imports: l2.kt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ STEP 0: | |
dirty js: lib1, lib2, main | ||
STEP 1: | ||
libs: lib1, lib2, main | ||
dirty js: lib1 | ||
dirty js: lib1, lib2 |
3 changes: 3 additions & 0 deletions
3
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/lib1/js.0.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fun test() : dynamic { | ||
return js("var testObj = { $constKey: 0 }; testObj.$constKey") | ||
} |
3 changes: 3 additions & 0 deletions
3
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/lib1/js.1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fun test() : dynamic { | ||
return js("var testObj = { $constKey: 1 }; testObj.$constKey") | ||
} |
3 changes: 3 additions & 0 deletions
3
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/lib1/js.2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fun test() : dynamic { | ||
return js("var testObj = { $constKey: $constVal }; testObj.$constKey") | ||
} |
3 changes: 3 additions & 0 deletions
3
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/lib1/js.6.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fun test() : dynamic { | ||
return js("var testObj = { ${constKey1}__bar: $constVal + 1 }; testObj.foo__$constKey2") | ||
} |
4 changes: 4 additions & 0 deletions
4
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/lib1/l1.0.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
internal const val constKey = "foo" | ||
|
||
internal const val constVal = "2" | ||
|
7 changes: 7 additions & 0 deletions
7
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/lib1/l1.3.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
internal const val constKey1 = "foo" | ||
internal const val constKey2 = "bar" | ||
|
||
internal const val constKey = constKey1 + "_" + constKey2 | ||
|
||
internal const val constVal = "3" | ||
|
7 changes: 7 additions & 0 deletions
7
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/lib1/l1.5.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
internal const val constKey1 = "foo" | ||
internal const val constKey2 = "bar" | ||
|
||
internal const val constKey = constKey1 + "__" + constKey2 | ||
|
||
internal const val constVal = "4" | ||
|
7 changes: 7 additions & 0 deletions
7
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/lib1/l1.7.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
internal const val constKey1 = "foo" | ||
internal const val constKey2 = "bar" | ||
|
||
internal const val constKey = constKey1 + "__" + constKey2 | ||
|
||
internal const val constVal = 5 | ||
|
38 changes: 38 additions & 0 deletions
38
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/lib1/module.info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
STEP 0: | ||
modifications: | ||
U : l1.0.kt -> l1.kt | ||
U : js.0.kt -> js.kt | ||
U : test.0.kt -> test.kt | ||
added file: l1.kt, js.kt, test.kt | ||
STEP 1: | ||
modifications: | ||
U : js.1.kt -> js.kt | ||
modified ir: js.kt | ||
STEP 2: | ||
modifications: | ||
U : js.2.kt -> js.kt | ||
modified ir: js.kt | ||
updated exports: l1.kt | ||
STEP 3: | ||
modifications: | ||
U : l1.3.kt -> l1.kt | ||
modified ir: l1.kt | ||
updated imports: js.kt | ||
STEP 4: | ||
modifications: | ||
U : test.4.kt -> test.kt | ||
modified ir: test.kt | ||
STEP 5: | ||
modifications: | ||
U : l1.5.kt -> l1.kt | ||
modified ir: l1.kt | ||
updated imports: js.kt | ||
STEP 6: | ||
modifications: | ||
U : js.6.kt -> js.kt | ||
modified ir: js.kt | ||
updated exports: l1.kt | ||
STEP 7: | ||
modifications: | ||
U : l1.7.kt -> l1.kt | ||
modified ir: l1.kt, js.kt |
1 change: 1 addition & 0 deletions
1
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/lib1/test.0.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fun doTest() = test() |
1 change: 1 addition & 0 deletions
1
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/lib1/test.4.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fun doTest() = test() + 1 |
8 changes: 8 additions & 0 deletions
8
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/main/m.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
fun box(stepId: Int): String { | ||
val x = doTest() | ||
when (stepId) { | ||
in 0..7 -> if (x != stepId) return "Fail, got $x" | ||
else -> return "Unknown" | ||
} | ||
return "OK" | ||
} |
5 changes: 5 additions & 0 deletions
5
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/main/module.info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
STEP 0: | ||
dependencies: lib1 | ||
added file: m.kt | ||
STEP 1..7: | ||
dependencies: lib1 |
8 changes: 8 additions & 0 deletions
8
js/js.translator/testData/incremental/invalidation/jsCodeWithConstString/project.info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
MODULES: lib1, main | ||
|
||
STEP 0: | ||
libs: lib1, main | ||
dirty js: lib1, main | ||
STEP 1..7: | ||
libs: lib1, main | ||
dirty js: lib1 |