Skip to content

Instantly share code, notes, and snippets.

@tobie
Created June 16, 2017 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobie/17043c4b9ce27226dca37f08a2534d4c to your computer and use it in GitHub Desktop.
Save tobie/17043c4b9ce27226dca37f08a2534d4c to your computer and use it in GitHub Desktop.
function traverse_inherited_and_consequential_interfaces(stack, callback) {
var I = stack.pop();
callback(I);
I.array["implements"][I.name].forEach(id => {
var mixin = I.array.members[id];
if (!mixin) {
throw new Error("Interface " + id + " not found (implemented by " + I.name + ")");
}
var interfaces = mixin.get_inheritance_stack();
traverse_inherited_and_consequential_interfaces(interfaces, callback);
});
if (stack.length > 0) {
traverse_inherited_and_consequential_interfaces(stack, callback);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment