Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KE2: Extract lambda expressions #18110

Merged
merged 4 commits into from
Nov 27, 2024
Merged

KE2: Extract lambda expressions #18110

merged 4 commits into from
Nov 27, 2024

Conversation

tamasvajk
Copy link
Contributor

No description provided.

@tamasvajk tamasvajk marked this pull request as ready for review November 27, 2024 09:24
@tamasvajk tamasvajk requested a review from a team as a code owner November 27, 2024 09:24
fun getLocallyVisibleFunctionLabelMapping(
key: KaFunctionSymbol
): LocallyVisibleFunctionLabels {
lock.withLock {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will only be used in a TrapWriter for a source file, not a diagnostic TRAP writer, so it isn't shared and won't need to use a lock. I think I'll take a look at refactoring TrapLabelManager to make it easier to use locks only when necessary, but for now let's at least add a TODO comment reminding us to come back to this.

key: KaFunctionSymbol,
add: (KaFunctionSymbol) -> LocallyVisibleFunctionLabels
): LocallyVisibleFunctionLabels {
lock.withLock {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto TODO comment


is KtLambdaExpression -> {
// Propagate extraction to the wrapped function literal:
return extractExpression(e.functionLiteral, callable, parent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all function literals wrapped by a lambda expression?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so.

* return invoke(args[0] as T0, args[1] as T1, ..., args[I] as TI)
* }
* }
* ```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useful comments, thanks!

elementToReportOn: PsiElement,
compilerGeneratedKindOverride: CompilerGeneratedKinds? = null,
superConstructorSelector: (KaFunctionSymbol) -> Boolean = { it.valueParameters.isEmpty() },
extractSuperConstructorArgs: (Label<DbSuperconstructorinvocationstmt>) -> Unit = {},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just inline the default here too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can now be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, I missed that. Anyway, like you say, we can always add it back if we need it.

@tamasvajk tamasvajk merged commit 7e77ad2 into github:ke2 Nov 27, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants