Use a struct instead of a bool variant

Helps it be a bit more readable!
This commit is contained in:
Alex Crichton
2018-04-17 11:29:03 -07:00
parent 0e032955fb
commit f80a7067a0
2 changed files with 25 additions and 12 deletions

View File

@ -140,10 +140,10 @@ impl<'a, 'b> Rust2Js<'a, 'b> {
return
}
if let Some((f, mutable)) = arg.ref_closure() {
if let Some(closure) = arg.ref_closure() {
let (js, _ts) = {
let mut builder = Js2Rust::new("", self.cx);
if mutable {
if closure.mutable {
builder.prelude("let a = this.a;\n")
.prelude("this.a = 0;\n")
.rust_argument("a")
@ -153,7 +153,7 @@ impl<'a, 'b> Rust2Js<'a, 'b> {
}
builder
.rust_argument("this.b")
.process(f)
.process(&closure.function)
.finish("function", "this.f")
};
self.cx.expose_get_global_argument();