fix: universal benchmarks and DI registration; proper named binding; robust override support for cherrypick and get_it; improved CLI args

This commit is contained in:
Sergey Penkovsky
2025-08-07 09:15:26 +03:00
parent d523a5f261
commit 64f33b20a7
11 changed files with 233 additions and 52 deletions

View File

@@ -85,8 +85,8 @@ class UniversalChainModule extends Module {
break;
case UniversalScenario.named:
// Named factory registration for two distinct objects.
bind<Object>().toProvide(() => UniversalServiceImpl(value: 'impl1')).withName('impl1');
bind<Object>().toProvide(() => UniversalServiceImpl(value: 'impl2')).withName('impl2');
bind<UniversalService>().toProvide(() => UniversalServiceImpl(value: 'impl1')).withName('impl1');
bind<UniversalService>().toProvide(() => UniversalServiceImpl(value: 'impl2')).withName('impl2');
break;
case UniversalScenario.chain:
// Chain of nested services, with dependency on previous level by name.
@@ -126,9 +126,18 @@ class UniversalChainModule extends Module {
}
}
}
// Регистрация алиаса без имени (на последний элемент цепочки)
final depName = '${chainCount}_${nestingDepth}';
bind<UniversalService>()
.toProvide(() => currentScope.resolve<UniversalService>(named: depName))
.singleton();
break;
case UniversalScenario.override:
// handled at benchmark level
// handled at benchmark level, но алиас нужен прямо в этом scope!
final depName = '${chainCount}_${nestingDepth}';
bind<UniversalService>()
.toProvide(() => currentScope.resolve<UniversalService>(named: depName))
.singleton();
break;
case UniversalScenario.asyncChain:
// already handled above