Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

super.foo() doesn't work for mixin's mixins #61

Open
wkeese opened this issue Jun 12, 2021 · 0 comments
Open

super.foo() doesn't work for mixin's mixins #61

wkeese opened this issue Jun 12, 2021 · 0 comments

Comments

@wkeese
Copy link

wkeese commented Jun 12, 2021

I constructed a class hierarchy like

B extends A
C extends A
Test extends Root, B, C

It ends up that A is essentially dropped, or at least B and C's calls to super.foo() don't make it to A.

The full test case is:

import { mix } from "mics/src/index";

const Root = mix(Base => class extends Base {
	foo () {
		return "Root";
	}
});

// Root mixin A.
const MixinA = mix(Base => class extends Base {
	foo () {
		return super.foo() + " MixinA ";
	}
});

// Mixin B extends root mixin A.
const MixinB = mix(MixinA, Base => class extends Base {
	foo () {
		return super.foo() + " MixinB ";
	}
});

// Mixin C also extends root mixin A.
const MixinC = mix(MixinA, Base => class extends Base {
	foo () {
		return super.foo() + " MixinC ";
	}
});

// Test extends Root, mixing in B and C
const Test = mix(Root, MixinB, MixinC, Base => class extends Base {
	foo () {
		return super.foo() + " Test";
	}
});

const test = new Test.class();
console.log(test.foo());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant