diff options
author | Ofek <ofekshilon@gmail.com> | 2024-01-21 18:25:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-21 10:25:25 -0600 |
commit | 163605aca0c704fe878138d80cbb9edb73c62f51 (patch) | |
tree | 917fba1cda577d0cfa4693b4e0605efee3cea1eb /lib/compilers/kotlin.ts | |
parent | ab937c5d151807eeff8d0735ca999ae36ff10392 (diff) | |
download | compiler-explorer-163605aca0c704fe878138d80cbb9edb73c62f51.tar.gz compiler-explorer-163605aca0c704fe878138d80cbb9edb73c62f51.zip |
Fix #5126: fix event_hub.mediateDependentCalls (#6031)gh-10272
Pane contents are populated by `<pane>.onCompileResult`, triggered by
`eventHub.emit('compileResult'..)` in `compiler.ts`.
The contents' colors are updated by `<pane>.onColours`, triggered mainly
by `eventHub.emit('colours'...)` invoked indirectly by
`editor.onCompileResult`. (colors are an editor property).
The order of invocations is governed by the order of registration and is
hard to control, and so a mechanism was devised to cache `onColours`
arguments and invoke it only after `onCompileResult`:
`mediateDependentCalls`:
https://github.com/compiler-explorer/compiler-explorer/blob/ab937c5d151807eeff8d0735ca999ae36ff10392/static/event-hub.ts#L93-L116
It is coded as a generic mechanism but used only for this
color->compileResult dependency in ir-view and ast-view.
I imagine this worked for a while, but somewhere along the line
triggering of events got messier - there are now multiple compilation
runs that generate different contents, and the `mediateDependentCalls`
logic breaks for some triggering orders, eg: dependent -> dependency ->
dependency. (note how
https://github.com/compiler-explorer/compiler-explorer/blob/ab937c5d151807eeff8d0735ca999ae36ff10392/static/event-hub.ts#L104
prevents `dependent` from being called after the last `dependency`
call).
This PR fixes `mediateDependentCalls` to make it call `dependent` with
its _latest_ arguments after _every_ `dependency` call.
This brings color back to IR and to AST. Until a few days ago I wasn't
aware they were already colored in the past, and I suspects others
weren't aware either:
https://github.com/compiler-explorer/compiler-explorer/issues/5475#issuecomment-1714699031
Diffstat (limited to 'lib/compilers/kotlin.ts')
0 files changed, 0 insertions, 0 deletions