set up semantic visitor

This commit is contained in:
2024-08-13 14:03:23 +00:00
parent b010326e60
commit 1ba056f0ac
12 changed files with 661 additions and 62 deletions

View File

@ -13,6 +13,7 @@ class ScopeBase {
friend class FunctionScope;
friend class ClassDefScope;
friend class GlobalScope;
friend class ASTSemanticCheckVisitor;
protected:
ScopeBase *parent; // cannot use std::shared_ptr<ScopeBase> because of circular dependency
@ -118,8 +119,10 @@ class ClassDefScope : public ScopeBase {
return false;
}
}
if (member_functions.find(name) != member_functions.end()) {
return false;
if (ttl == 0) {
if (member_functions.find(name) != member_functions.end()) {
return false;
}
}
return parent->VariableNameAvailable(name, ttl + 1);
}