Fine tune Engine size.

This commit is contained in:
Stephen Chung
2023-03-07 16:52:37 +08:00
parent 3e784d592d
commit fa4096e91e
8 changed files with 56 additions and 54 deletions

View File

@@ -205,9 +205,13 @@ impl Engine {
}
// Report progress
self.progress
.as_ref()
.and_then(|p| p(global.num_operations))
.map_or(Ok(()), |token| Err(ERR::ErrorTerminated(token, pos).into()))
if let Some(ref progress) = self.progress {
match progress(global.num_operations) {
None => Ok(()),
Some(token) => Err(ERR::ErrorTerminated(token, pos).into()),
}
} else {
Ok(())
}
}
}

View File

@@ -510,7 +510,7 @@ impl Engine {
let src = global.source_raw().cloned();
let src = src.as_ref().map(|s| s.as_str());
let context = EvalContext::new(self, global, caches, scope, this_ptr);
let (.., ref on_debugger) = **x;
let (.., ref on_debugger) = *x;
let command = on_debugger(context, event, node, src, node.position());