Skip to content

Instantly share code, notes, and snippets.

@srawlins
Created June 14, 2018 21:59
Show Gist options
  • Save srawlins/9c8d2f39e29eed151108afa2c149ca5c to your computer and use it in GitHub Desktop.
Save srawlins/9c8d2f39e29eed151108afa2c149ca5c to your computer and use it in GitHub Desktop.
nSM Forwarding between VM and dart2js disagree - VM loses default values
void main() {
var a = new AImpl();
var b = new B(a);
print("CALLING W/O NAMED ARG");
b.a();
print("CALLING W/ NAMED ARG");
b.a(followLinks: false);
}
abstract class A {
a({followLinks: true});
}
class AImpl implements A {
a({followLinks: true}) {
print('AImpl: followLinks is $followLinks');
if (followLinks) print('yay');
if (!followLinks) print('nay');
}
}
class BestMixinEvar {
final methods = <Symbol, Function>{};
noSuchMethod(Invocation i) {
var na = i.namedArguments;
print('BestMixinEvar.noSuchMethod: namedargs: $na');
if (i.memberName == #a) return Function.apply(methods[#a], [], na);
}
}
class B extends A with BestMixinEvar {
A delegate;
B(this.delegate) {
methods.addAll(<Symbol, Function>{
#a: delegate.a,
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment