Only create scope in LetDeclaration if it is a function

This commit is contained in:
Sam Vervaeck 2023-06-12 16:50:55 +02:00
parent d81e92231f
commit 35bcf38eb3
Signed by: samvv
SSH key fingerprint: SHA256:dIg0ywU1OP+ZYifrYxy8c5esO72cIKB+4/9wkZj1VaY

View file

@ -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 {