createPureProxy method
void
createPureProxy(
- Expression fn,
- int argCount,
- ReadClassMemberExpr pureProxyProp, {
- OutputType? pureProxyType,
Implementation
void createPureProxy(
o.Expression fn,
int argCount,
o.ReadClassMemberExpr pureProxyProp, {
o.OutputType? pureProxyType,
}) {
var proxy = storage.allocate(
pureProxyProp.name,
outputType: pureProxyType,
modifiers: const [
o.StmtModifier.Private,
o.StmtModifier.Late,
o.StmtModifier.Final,
],
);
var pureProxyId = argCount < Identifiers.pureProxies.length
? Identifiers.pureProxies[argCount]
: null;
if (pureProxyId == null) {
throw StateError(
'Unsupported number of argument for pure functions: $argCount');
}
_createMethod.addStmt(storage
.buildWriteExpr(proxy, o.importExpr(pureProxyId).callFn([fn]))
.toStmt());
}