Skip to content

Instantly share code, notes, and snippets.

@tobie

tobie/traverse.js

Created Jun 16, 2017
Embed
What would you like to do?
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