Skip to content

Commit a70a9eb

Browse files
fix(wasm): use rustc-style multi-line diagnostics instead of one-liner
1 parent 689dee1 commit a70a9eb

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

compiler/src/modules/parser/types.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ impl Diagnostic {
228228
}
229229
}
230230

231-
#[cfg(not(target_arch = "wasm32"))]
232231
impl Diagnostic {
233232
/* rustc-style multi-line render with source preview and caret:
234233
@@ -268,8 +267,7 @@ impl Diagnostic {
268267
}
269268

270269
impl Diagnostic {
271-
/* Compact one-line render: `path:line:col: msg`. No source preview.
272-
Used by WASM (host renders preview) and by tests. */
270+
/* Compact one-line render: `path:line:col: msg`. No source preview. Used by tests. */
273271
pub fn render_oneline(&self, src: &str, path: Option<&str>) -> alloc::string::String {
274272
use crate::s;
275273
let (line, col) = Self::line_col(src, self.start);

compiler/src/wasm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mod runtime {
4545
let mut s = String::new();
4646
for (i, e) in errs.iter().enumerate() {
4747
if i > 0 { s.push('\n'); }
48-
s.push_str(&s!("syntax error at ", str &e.render_oneline(src, None)));
48+
s.push_str(&e.render(src, None));
4949
}
5050
s
5151
} else {

0 commit comments

Comments
 (0)