scala/scala — comment on commit fc2866efee1bcf17aee18d427ed41e172f440f62
File: src/compiler/scala/tools/nsc/transform/UnCurry.scala line 472
By magarciaEPFL:

I see the advantages of performing `translateSynchronized(tree: Tree)` during UnCurry (fewer ObjectRef and so on are emitted).

A follow-up improvement is worth considering. Say the compiler defines two fake library methods "monitor_enter(onObject)" and "monitor_exit(onObject)", and replaces a "onObject synchronized { ... }" with a Block whose body starts and ends with them. Then we get all the benefits of closure elimination for synchronized expressions, and not only for the outermost ones in a method definition.