mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-28 04:01:33 +00:00
Fix #[wasm_bindgen]
on structs with no exports
It should still be usable in other types! Closes #27
This commit is contained in:
@ -224,3 +224,47 @@ fn pass_one_to_another() {
|
||||
"#)
|
||||
.test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_27() {
|
||||
test_support::project()
|
||||
.file("src/lib.rs", r#"
|
||||
#![feature(proc_macro)]
|
||||
|
||||
extern crate wasm_bindgen;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct Context {}
|
||||
|
||||
#[wasm_bindgen]
|
||||
impl Context {
|
||||
pub fn parse(&self, expr: &str) -> Expr {
|
||||
panic!()
|
||||
}
|
||||
pub fn eval(&self, expr: &Expr) -> f64 {
|
||||
panic!()
|
||||
}
|
||||
pub fn set(&mut self, var: &str, val: f64) {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct Expr {}
|
||||
|
||||
#[wasm_bindgen]
|
||||
#[no_mangle]
|
||||
pub extern fn context() -> Context {
|
||||
Context {}
|
||||
}
|
||||
"#)
|
||||
.file("test.ts", r#"
|
||||
import { context } from "./out";
|
||||
|
||||
export function test() {
|
||||
context();
|
||||
}
|
||||
"#)
|
||||
.test();
|
||||
}
|
||||
|
Reference in New Issue
Block a user