mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-20 12:10:52 +00:00
* Make ConvertToAst trait fallible It's got some panics, and we'll be switching those to errors! * First example of a diagnostic-driven error Add a diagnostic-driven error `#[wasm_bindgen]` being attached to public functions, and add some macros to boot to make it easier to generate errors! * Result-ify `src/parser.rs` This commit converts all of `src/parser.rs` away from panics to using `Diagnostic` instead. Along the way this adds a test case per changed `panic!`, ensuring that we don't regress in these areas!
24 lines
260 B
Rust
24 lines
260 B
Rust
#![feature(use_extern_macros)]
|
|
|
|
extern crate wasm_bindgen;
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
#[wasm_bindgen]
|
|
enum A {}
|
|
|
|
#[wasm_bindgen]
|
|
pub enum B {
|
|
D(u32),
|
|
}
|
|
|
|
#[wasm_bindgen]
|
|
pub enum C {
|
|
X = 1 + 3,
|
|
}
|
|
|
|
#[wasm_bindgen]
|
|
pub enum D {
|
|
X = 4294967296,
|
|
}
|