Add Invocation constructors #14776
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
closed-as-intended
Closed as the reported issue is expected behavior
This issue was originally filed by @seaneagan
From the mailing list:
https://groups.google.com/a/dartlang.org/d/msg/misc/yc57k6TflOQ/UYOeNH-kRU0J
I have a use case for constructing Invocations, but Invocation currently has no constructors.
I could potentially do:
class InvocationMaker {
noSuchMethod(Invocation invocation) => invocation;
}
var invocation = new InvocationMaker().a(b, c: d);
But that is clearly a hack, and noSuchMethod won't get called for things like == and hashCode that are in Object.
I could also implement Invocation on my own, but will that work when I pass it to InstanceMirror#delegate?
The Invocation constructors could be something like:
Invocation.getter(Symbol fieldName);
Invocation.setter(Symbol fieldName, value);
Invocation.method(
Symbol methodName,
{List positionalArguments,
Map<Symbol, dynamic> namedArguments});
The text was updated successfully, but these errors were encountered: