[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 76/99: Separate public / private module lookups
From: |
Christopher Allan Webber |
Subject: |
[Guile-commits] 76/99: Separate public / private module lookups |
Date: |
Sun, 10 Oct 2021 21:51:07 -0400 (EDT) |
cwebber pushed a commit to branch compile-to-js-merge
in repository guile.
commit d3dea512c9b5d77e1e977b5d12a65f37602777f9
Author: Ian Price <ianprice90@googlemail.com>
AuthorDate: Wed Aug 16 21:30:28 2017 +0100
Separate public / private module lookups
* module/language/js-il/runtime.js:
(scm_public_variable, scm_module_public_interface,
module_public_interface_var, scm_post_boot_init_modules):
Implement Public Variable Lookup
(scm_private_lookup, scm_private_variable): Implement Private Lookup
---
module/language/js-il/runtime.js | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/module/language/js-il/runtime.js b/module/language/js-il/runtime.js
index aa38b0a..299a0d3 100644
--- a/module/language/js-il/runtime.js
+++ b/module/language/js-il/runtime.js
@@ -445,18 +445,34 @@ function scm_public_variable(module_name, name) {
// scm_misc_error ("public-lookup", "Module named ~s does not exist",
// scm_list_1 (module_name));
- // iface = scm_module_public_interface (mod);
+ var iface = scm_module_public_interface (mod);
// if (scm_is_false (iface))
// scm_misc_error ("public-lookup", "Module ~s has no public interface",
// scm_list_1 (mod));
- return scm_module_variable (mod, name);
+ return scm_module_variable (iface, name);
+}
+
+var module_public_interface_var;
+
+function scm_module_public_interface (module) {
+ return scheme.call(module_public_interface_var.x, module);
}
function scm_private_lookup(module_name, sym) {
// FIXME: scm_private_variable + miscerror if not bound
- return scm_public_lookup(module_name, sym);
+ return scm_private_variable(module_name, sym);
+}
+
+function scm_private_variable (module_name, name) {
+ var mod = scheme.call(resolve_module_var.x, module_name, k_ensure,
scheme.FALSE);
+
+ // if (scm_is_false (mod))
+ // scm_misc_error ("private-lookup", "Module named ~s does not exist",
+ // scm_list_1 (module_name));
+
+ return scm_module_variable (mod, name);
}
scheme.primitives["current-module"] = scm_current_module;
@@ -1335,6 +1351,7 @@ function scm_post_boot_init_modules() {
the_root_module = scm_lookup (new scheme.Symbol("the-root-module"));
k_ensure = new scheme.Keyword("ensure");
resolve_module_var = scm_lookup (new scheme.Symbol("resolve-module"));
+ module_public_interface_var = scm_lookup (new
scheme.Symbol("module-public-interface"));
}
// Stubs
- [Guile-commits] 14/99: Add binop type, (continued)
- [Guile-commits] 14/99: Add binop type, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 53/99: Implement Winding & Unwinding, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 63/99: Implement hashtable built-ins, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 66/99: Implement misc built-ins, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 61/99: define! primitive only takes one argument., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 69/99: Unwind prompt frames, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 67/99: Make child structs applicable., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 74/99: Reimplement JS module system primitives., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 95/99: Fix import of lower-cps in compile-js.scm, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 73/99: Implement unboxed integer primitives., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 76/99: Separate public / private module lookups,
Christopher Allan Webber <=
- [Guile-commits] 77/99: Search for variables in imports., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 93/99: Fix module/Makefile.am after compile-to-js merge, Christopher Allan Webber, 2021/10/10