-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Labels
Description
For example, imagine I was to construct a factory that forwards its parameters to a constructor:
class Foo {
factory Foo(A a, B b, C c) {
return new Foo._(a, b, c);
}
Foo._(A a, B b, C c);
}To generate factory Foo(A a, B b, C c) I will have a List<ParameterBuilder>. To forward the parameters to Foo._, I want to be able to convert List<ParameterBuilder> to a List<ExpressionBuilder> args and pass that to myType.newInstance(args).
Example:
List<ExpressionBuilder> forwardParamsToArgs(List<ParameterBuilder> params) {
return params.map<ExpressionBuilder>((p) => reference(p.name)).toList();
}Unfortunately p.name does not exist.