Skip to content

Commit

Permalink
Simplify && handling
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Jan 28, 2022
1 parent a421988 commit 9c6f380
Showing 1 changed file with 8 additions and 11 deletions.
Expand Up @@ -181,25 +181,22 @@ public static function analyze(
}

if ($context->if_context && !$context->inside_negation) {
$context->vars_in_scope = $right_context->vars_in_scope;
$if_context = $context->if_context;

foreach ($right_context->vars_in_scope as $var_id => $type) {
if (!isset($if_context->vars_in_scope[$var_id])) {
$if_context->vars_in_scope[$var_id] = $type;
} elseif (isset($context->vars_in_scope[$var_id])) {
$if_context->vars_in_scope[$var_id] = $context->vars_in_scope[$var_id];
}
}
$context->vars_in_scope = $right_context->vars_in_scope;
$if_context->vars_in_scope = array_merge(
$if_context->vars_in_scope,
$context->vars_in_scope
);

$if_context->referenced_var_ids = array_merge(
$if_context->referenced_var_ids,
$context->referenced_var_ids,
$if_context->referenced_var_ids
);

$if_context->assigned_var_ids = array_merge(
$if_context->assigned_var_ids,
$context->assigned_var_ids,
$if_context->assigned_var_ids
);

$if_context->reconciled_expression_clauses = array_merge(
Expand All @@ -211,8 +208,8 @@ public static function analyze(
);

$if_context->vars_possibly_in_scope = array_merge(
$if_context->vars_possibly_in_scope,
$context->vars_possibly_in_scope,
$if_context->vars_possibly_in_scope
);

$if_context->updateChecks($context);
Expand Down

0 comments on commit 9c6f380

Please sign in to comment.