1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-19 18:20:22 +02:00

Make child structs applicable.

* module/language/js-il/runtime.js (scheme.Struct): When certain flags
  are set, child structs should be marked as applicable.
This commit is contained in:
Ian Price 2017-08-03 00:22:03 +01:00
parent 46fa3b2fb8
commit 70c25b1290

View file

@ -439,6 +439,22 @@ scheme.Struct = function (vtable, nfields) {
this.vtable = vtable;
this.fields = [];
if (this.vtable && this.vtable.hasOwnProperty('children_applicable_vtables')) {
this.is_vtable = true;
this.children_applicable = true;
}
if (this.vtable && this.vtable.hasOwnProperty('children_applicable')) {
this.is_applicable = true;
this.fun = function (self, cont) {
var scm_applicable_struct_index_procedure = 0;
var clos = self.fields[scm_applicable_struct_index_procedure];
return clos.fun(clos, cont);
};
} else {
this.fun = function () { throw "not applicable"; };
}
// FIXME: worth doing?
for(var i = 0; i < nfields; i++){
this.fields[i]=scheme.UNDEFINED;