diff --git a/src/language/scoping/safe-ds-scope-provider.ts b/src/language/scoping/safe-ds-scope-provider.ts index b75a1b825..0ebf4be55 100644 --- a/src/language/scoping/safe-ds-scope-provider.ts +++ b/src/language/scoping/safe-ds-scope-provider.ts @@ -13,7 +13,6 @@ import { isSdsCallable, isSdsClass, isSdsEnum, - isSdsExpressionLambda, isSdsLambda, isSdsMemberAccess, isSdsMemberType, @@ -123,19 +122,18 @@ export class SafeDsScopeProvider extends DefaultScopeProvider { } private localDeclarations(node: AstNode, outerScope: Scope): Scope { - // Own parameters + // Parameters const containingCallable = getContainerOfType(node.$container, isSdsCallable); const parameters = parametersOrEmpty(containingCallable?.parameterList); - // Own placeholders - const containingExpressionLambda = getContainerOfType(node.$container, isSdsExpressionLambda); + // Placeholders up to the containing statement const containingStatement = getContainerOfType(node.$container, isSdsStatement); let placeholders: Iterable; - if (!containingExpressionLambda || isContainedIn(containingStatement, containingExpressionLambda)) { + if (!containingCallable || isContainedIn(containingStatement, containingCallable)) { placeholders = this.placeholdersUpToStatement(containingStatement); } else { - // We already jumped out of the expression lambda + // Placeholders are further away than the parameters placeholders = []; }