Skip to content

Make CatchClause scope optional #4345

@overlookmotel

Description

@overlookmotel

CatchClause does not need a scope if there's no param e.g. try {} catch {}. Add back #[scope(if(self.param.is_some()))].

As discussed in #4192 (review), there's an argument for making all scopes unconditional. But in my opinion, either way the most important thing is to be consistent, so scopes-related code is easier to reason about.

At present, our policy is not to create a scope if none is needed (because it has no bindings). So we should keep to that policy for CatchClause. If we want to change the policy, we can do that, but we should do it consistently for all scopes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-semanticArea - SemanticC-cleanupCategory - technical debt or refactoring. Solution not expected to change behavior

    Type

    No type

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions