From 35bcf38eb3bbfcc40a18d51a004bb95ba2618011 Mon Sep 17 00:00:00 2001 From: Sam Vervaeck Date: Mon, 12 Jun 2023 16:50:55 +0200 Subject: [PATCH] Only create scope in LetDeclaration if it is a function --- include/bolt/CST.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/bolt/CST.hpp b/include/bolt/CST.hpp index 3d890ddc1..4a766457d 100644 --- a/include/bolt/CST.hpp +++ b/include/bolt/CST.hpp @@ -1995,10 +1995,13 @@ namespace bolt { Body(Body) {} inline Scope* getScope() override { - if (TheScope == nullptr) { - TheScope = new Scope(this); + if (isFunction()) { + if (TheScope == nullptr) { + TheScope = new Scope(this); + } + return TheScope; } - return TheScope; + return Parent->getScope(); } bool isInstance() const noexcept {