-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
Description
Source:
.Method() when (default()) {
content: 'Not inverted';
}
.CallInverted(@callback) {
@invert: true;
@callback();
.Method() when (@invert) {
content: 'Inverted';
}
}
.Call(@callback) {
@invert: false;
@callback();
}
a {
.CallInverted({ .Method(); });
}
b {
.Call({ .Method(); });
}
c {
.Method();
}
Current Output:
a {
content: 'Not inverted';
}
b {
content: 'Not inverted';
}
c {
content: 'Not inverted';
}
Desired Output:
a {
content: 'Inverted';
}
b {
content: 'Not inverted';
}
c {
content: 'Not inverted';
}
Context: I want to make a set of mixins that are sometimes called in callbacks, and I want to make each one use a different definition from some callsites of the callbacks (the .CallInverted()
mixin).
I can't find any other way to do this, because the guard variable must be defined when called in global scope, and I can't override its value when called from a mixin.