-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Improve acceptVoid performances
#5630
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
base: master
Are you sure you want to change the base?
Conversation
…neBuilder` This would have caused issues when adding `acceptVoid` to `IrElement` KT-74618
KT-74618
KT-74618 Fixed
| this.body() | ||
| return this | ||
| } | ||
|
|
||
| protected fun IrElement.transformChildrenVoid() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we remove this function? It is used a lot, and quite handy? As you probably have only a single Transformer in code in most cases, and passing correct this is not very useful for readability.
| override fun <D> transform(transformer: IrTransformer<D>, data: D): IrBranch = | ||
| accept(transformer, data) as IrBranch | ||
|
|
||
| override fun transformVoid(transformer: IrElementTransformerVoid): IrBranch = | ||
| accept(transformer, null) as IrBranch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we not calling acceptVoid here?





This should save 2 calls on the call stack when calling
acceptVoid,acceptChildrenVoid,transformVoidandtransformChildrenVoidmethods.Example:
Before:
irBody.acceptVoid(visitor)->IrElement.acceptVoid(visitor)->IrBlockBody.accept(visitor, null)->IrVisitorVoid.visitBlockBody(visitBlockBody, null)->IrVisitorVoid.visitBlockBody(visitBlockBody)Now:
irBody.acceptVoid(visitor)->IrBlockBody.acceptVoid(visitor)->IrVisitorVoid.visitBlockBody(visitBlockBody)