Files
kotlin-fork/compiler/testData/codegen/box
Sergej Jaskiewicz d7d86a0e95 [JS IR] Lift lambdas that capture no context
If a lambda expression does not capture any local variables, convert
it to a global free function and replace the lambda creation with
a reference to that function.

Example: for the following Kotlin code

```kotlin
fun foo(f: () -> Unit) = f()

fun bar() = foo { console.log("hello") }
```

before this patch, we generated:

```js
function foo(f) {
  return f();
}
function bar() {
  return foo(bar$lambda());
}
function bar$lambda() {
  return function () {
    console.log('hello');
  };
}
```

after this patch, we generate:

```js
function foo(f) {
  return f();
}
function bar() {
  return foo(bar$lambda);
}
function bar$lambda() {
  console.log('hello');
}
```
2022-04-07 10:31:35 +00:00
..
2022-03-08 14:19:37 +01:00
2022-04-07 01:08:22 +00:00
2022-02-25 11:46:27 +00:00
2021-12-29 17:07:03 +00:00
2022-02-25 11:46:27 +00:00
2021-12-29 17:07:03 +00:00
2022-02-24 15:20:14 +03:00
2022-01-26 23:40:41 +03:00
2022-03-08 14:19:37 +01:00