* Toggle bytecode panel visibility for a source line * @param {HTMLElement} button - The toggle button that was clicked
(button)
| 497 | * @param {HTMLElement} button - The toggle button that was clicked |
| 498 | */ |
| 499 | function toggleBytecode(button) { |
| 500 | const lineDiv = button.closest('.code-line'); |
| 501 | const lineId = lineDiv.id; |
| 502 | const lineNum = lineId.replace('line-', ''); |
| 503 | const panel = document.getElementById(`bytecode-${lineNum}`); |
| 504 | const wrapper = document.getElementById(`bytecode-wrapper-${lineNum}`); |
| 505 | |
| 506 | if (!panel || !wrapper) return; |
| 507 | |
| 508 | const isExpanded = panel.classList.contains('expanded'); |
| 509 | |
| 510 | if (isExpanded) { |
| 511 | panel.classList.remove('expanded'); |
| 512 | wrapper.classList.remove('expanded'); |
| 513 | button.classList.remove('expanded'); |
| 514 | button.innerHTML = '▶'; // Right arrow |
| 515 | } else { |
| 516 | if (!panel.dataset.populated) { |
| 517 | populateBytecodePanel(panel, button); |
| 518 | } |
| 519 | panel.classList.add('expanded'); |
| 520 | wrapper.classList.add('expanded'); |
| 521 | button.classList.add('expanded'); |
| 522 | button.innerHTML = '▼'; // Down arrow |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | /** |
| 527 | * Populate bytecode panel with instruction data |
no test coverage detected
searching dependent graphs…