Skip to content

Commit

Permalink
Update naga 0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
poly committed Jul 2, 2022
1 parent f10bb4d commit 328fa0f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
10 changes: 6 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ walkdir = "2.3"
serde = { version = "1.0", features = ["derive"] }
jsonrpc-stdio-server = "18.0.0"
tokio = { version = "1", features = ["rt-multi-thread", "io-util", "time", "net"]}
naga = { version = "0.8.0", features = ["wgsl-in", "validate"] }
naga = { version = "0.9.0", features = ["wgsl-in", "validate"] }
16 changes: 14 additions & 2 deletions src/wgsl_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,20 @@ impl From<std::io::Error> for WgslError {

impl WgslError {
pub fn from_parse_err(err: ParseError, src: &str) -> Self {
let (line, pos) = err.location(src);
let error = err.emit_to_string(src);
Self::ParserErr { error, line, pos }
let loc = err.location(src);
if let Some(loc) = loc {
Self::ParserErr {
error,
line: loc.line_number as usize,
pos: loc.line_position as usize,
}
} else {
Self::ParserErr {
error,
line: 0,
pos: 0,
}
}
}
}

0 comments on commit 328fa0f

Please # to comment.