Skip to content

Commit f5499e3

Browse files
committed
Fix wrong file numbers on macro stack frames
1 parent 313a0f4 commit f5499e3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

frontend/components/ErrorMessage.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { open_bottom_right_panel } from "./BottomRightPanel.js"
88
import AnsiUp from "../imports/AnsiUp.js"
99

1010
const extract_cell_id = (/** @type {string} */ file) => {
11-
const sep_index = file.indexOf("#==#")
11+
if (file.includes("#@#==#")) return null
12+
const sep = "#==#"
13+
const sep_index = file.indexOf(sep)
1214
if (sep_index != -1) {
13-
return file.substring(sep_index + 4, sep_index + 4 + 36)
15+
return file.substring(sep_index + sep.length, sep_index + sep.length + 36)
1416
} else {
1517
return null
1618
}
@@ -60,22 +62,23 @@ const StackFrameFilename = ({ frame, cell_id }) => {
6062
if (ignore_location(frame)) return null
6163

6264
const frame_cell_id = extract_cell_id(frame.file)
65+
const line = frame.line
6366
if (frame_cell_id != null) {
6467
return html`<a
6568
internal-file=${frame.file}
6669
href=${`#${frame_cell_id}`}
6770
onclick=${(e) => {
68-
focus_line(frame_cell_id, frame.line - 1)
71+
focus_line(frame_cell_id, line == null ? null : line - 1)
6972
e.preventDefault()
7073
}}
7174
>
72-
${frame_cell_id == cell_id ? "This\xa0cell" : "Other\xa0cell"}: <em>line ${frame.line}</em>
75+
${frame_cell_id == cell_id ? "This\xa0cell" : "Other\xa0cell"}${line == null ? null : html`: <em>line ${line}</em>`}
7376
</a>`
7477
} else {
7578
const sp = frame.source_package
7679
const origin = ["Main", "Core", "Base"].includes(sp) ? "julia" : sp
7780

78-
const file_line = html`<em>${frame.file}:${frame.line}</em>`
81+
const file_line = html`<em>${frame.file.replace(/#@#==#.*/, "")}:${frame.line}</em>`
7982

8083
const text = sp != null ? html`<strong>${origin}</strong> → ${file_line}` : file_line
8184

0 commit comments

Comments
 (0)