mirror of
https://github.com/janet-lang/janet
synced 2025-10-29 14:47:42 +00:00
Support looking up missing symbols during compilation
This commit is contained in:
@@ -2746,6 +2746,8 @@
|
||||
(and as (string as "/"))
|
||||
prefix
|
||||
(string (last (string/split "/" path)) "/")))
|
||||
(unless (zero? (length prefix))
|
||||
(put-in env [:modules prefix] newenv))
|
||||
(merge-module env newenv prefix ep))
|
||||
|
||||
(defmacro import
|
||||
|
||||
@@ -607,8 +607,14 @@ JanetBinding janet_resolve_ext(JanetTable *env, const uint8_t *sym) {
|
||||
};
|
||||
|
||||
/* Check environment for entry */
|
||||
if (!janet_checktype(entry, JANET_TABLE))
|
||||
return binding;
|
||||
if (!janet_checktype(entry, JANET_TABLE)) {
|
||||
Janet fn_entry = janet_table_get(env, janet_ckeywordv("missing-symbol"));
|
||||
if (janet_checktype(fn_entry, JANET_FUNCTION)) {
|
||||
Janet args[2] = { janet_wrap_symbol(sym), janet_wrap_table(env) };
|
||||
entry = janet_call(janet_unwrap_function(fn_entry), 2, args);
|
||||
}
|
||||
if (!janet_checktype(entry, JANET_TABLE)) return binding;
|
||||
}
|
||||
entry_table = janet_unwrap_table(entry);
|
||||
|
||||
/* deprecation check */
|
||||
|
||||
Reference in New Issue
Block a user