Merge remote-tracking branch 'schungx/closures' into closures

This commit is contained in:
Ilya Lakhin
2020-07-31 13:05:16 +07:00
22 changed files with 665 additions and 322 deletions

View File

@@ -137,13 +137,13 @@ impl FnPtr {
&mut Default::default(),
lib.as_ref(),
fn_name,
false,
hash_script,
args.as_mut(),
has_this,
has_this,
true,
None,
None,
0,
)
.map(|(v, _)| v)
@@ -287,6 +287,16 @@ impl CallableFunction {
Self::Pure(_) | Self::Method(_) | Self::Iterator(_) => false,
}
}
/// Is this a native Rust function?
pub fn is_native(&self) -> bool {
match self {
Self::Pure(_) | Self::Method(_) => true,
Self::Iterator(_) => true,
#[cfg(not(feature = "no_function"))]
Self::Script(_) => false,
}
}
/// Get the access mode.
pub fn access(&self) -> FnAccess {
match self {