Splitting registration methods

This commit is contained in:
Pavel Shevaev 2024-11-20 15:34:22 +03:00
parent c2030384f0
commit 814993936e
1 changed files with 27 additions and 5 deletions

View File

@ -48,14 +48,36 @@ class BindEclLitePlugin implements \bhl_bind\BindPlugin
return '';
}
function codegenRegisterDecls(\Twig\Environment $twig)
{
$sliced = \bhl_bind\slice_units($this->units, 20);
$code = '';
foreach($sliced as $idx => $units)
{
$code .= "public static void Register_Ecslite_$idx(Types types)\n";
$code .= "{\n";
foreach($units as $u)
{
if($u->object->hasToken('bhl_ecslite_component'))
$code .= $twig->render('bind_ecslite.twig', ['unit' => $u->object]);
}
$code .= "\n}\n";
}
return $code;
}
function codegenRegister(\Twig\Environment $twig)
{
$sliced = \bhl_bind\slice_units($this->units, 20);
$code = '';
foreach($this->units as $u)
{
if($u->object->hasToken('bhl_ecslite_component'))
$code .= $twig->render('bind_ecslite.twig', ['unit' => $u->object]);
}
foreach($sliced as $idx => $units)
$code .= "Register_Ecslite_$idx(types);\n";
return $code;
}
}