Skip to content

Commit

Permalink
Optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Aug 17, 2022
1 parent 0220da0 commit 979091d
Showing 1 changed file with 19 additions and 14 deletions.
Expand Up @@ -109,6 +109,23 @@ public static function collect(
}
}

$template_result = null;
if ($class_storage !== $static_class_storage && $static_class_storage->template_types) {
$templates = self::collect(
$codebase,
$static_class_storage,
$static_class_storage,
null,
$lhs_type_part
);
if ($templates === null) {
throw new AssertionError("Could not collect templates!");
}
$template_result = new TemplateResult(
$static_class_storage->template_types,
$templates
);
}
foreach ($template_types as $type_name => $_) {
if (isset($class_template_params[$type_name])) {
continue;
Expand All @@ -123,7 +140,8 @@ public static function collect(
$codebase,
$input_type_extends,
$static_class_storage,
$lhs_type_part
$lhs_type_part,
$template_result
);

$class_template_params[$type_name][$class_storage->name]
Expand Down Expand Up @@ -173,19 +191,6 @@ private static function resolveTemplateParam(
TGenericObject $lhs_type_part,
?TemplateResult $template_result = null
): ?Union {
if ($template_result === null && $static_class_storage->template_types) {
$templates = self::collect(
$codebase,
$static_class_storage,
$static_class_storage,
null,
$lhs_type_part
);
if ($templates === null) {
throw new AssertionError("Could not collect templates!");
}
$template_result = new TemplateResult($static_class_storage->template_types, $templates);
}
$output_type_extends = null;
foreach ($input_type_extends->getAtomicTypes() as $type_extends_atomic) {
if ($type_extends_atomic instanceof TTemplateParam) {
Expand Down

0 comments on commit 979091d

Please sign in to comment.