diff --git a/src/bind.inc.php b/src/bind.inc.php index 3eef75a..7fd6939 100644 --- a/src/bind.inc.php +++ b/src/bind.inc.php @@ -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; } }