aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/bif.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-05-12 14:26:30 +0200
committerBjörn Gustavsson <[email protected]>2014-05-12 14:37:22 +0200
commit7ff17ddfd337d1c49c1174d8d24b2ce0671b2c9e (patch)
treec5bd1ae2ec0d187b6a7f89cbee1acfd23f29a261 /erts/emulator/beam/bif.c
parent80a528ae9ca670cad91eccf97b385baf67b09981 (diff)
downloadotp-7ff17ddfd337d1c49c1174d8d24b2ce0671b2c9e.tar.gz
otp-7ff17ddfd337d1c49c1174d8d24b2ce0671b2c9e.tar.bz2
otp-7ff17ddfd337d1c49c1174d8d24b2ce0671b2c9e.zip
BIFs should be considered exported
All BIFs now have stub functions and are exported. For example in the erlang module: -export([..., is_list/1, ...]). . . . is_list(_Term) -> erlang:nif_error(undefined). But erlang:function_exported(erlang, is_list, 1) returns false, which is weird. Change erlang:function_exported/3 to return true for BIFs.
Diffstat (limited to 'erts/emulator/beam/bif.c')
-rw-r--r--erts/emulator/beam/bif.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index 06a1230ca0..787a3da1f4 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -3984,16 +3984,19 @@ BIF_RETTYPE halt_2(BIF_ALIST_2)
BIF_RETTYPE function_exported_3(BIF_ALIST_3)
{
+ int arity;
if (is_not_atom(BIF_ARG_1) ||
is_not_atom(BIF_ARG_2) ||
is_not_small(BIF_ARG_3)) {
BIF_ERROR(BIF_P, BADARG);
}
- if (erts_find_function(BIF_ARG_1, BIF_ARG_2, signed_val(BIF_ARG_3),
- erts_active_code_ix()) == NULL) {
- BIF_RET(am_false);
+ arity = signed_val(BIF_ARG_3);
+ if (erts_find_function(BIF_ARG_1, BIF_ARG_2, arity,
+ erts_active_code_ix()) != NULL ||
+ erts_is_builtin(BIF_ARG_1, BIF_ARG_2, arity)) {
+ BIF_RET(am_true);
}
- BIF_RET(am_true);
+ BIF_RET(am_false);
}
/**********************************************************************/