diff options
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 6d579e1fb..af19f484d 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -673,7 +673,7 @@ namespace Slang // Make sure a declaration has been checked, so we can refer to it. // Note that this may lead to us recursively invoking checking, // so this may not be the best way to handle things. - void SemanticsVisitor::ensureDecl(Decl* decl, DeclCheckState state) + void SemanticsVisitor::ensureDecl(Decl* decl, DeclCheckState state, SemanticsContext* baseContext) { // If the `decl` has already been checked up to or beyond `state` // then there is nothing for us to do. @@ -733,7 +733,7 @@ namespace Slang // context, so that the state at the point where a declaration is *referenced* // cannot affect the state in which the declaration is *checked*. // - SemanticsContext subContext(getShared()); + SemanticsContext subContext = baseContext ? SemanticsContext(*baseContext) : SemanticsContext(getShared()); _dispatchDeclCheckingVisitor(decl, nextState, subContext); // In the common case, the visitor will have done the necessary @@ -3609,17 +3609,17 @@ namespace Slang } } - void SemanticsVisitor::ensureDeclBase(DeclBase* declBase, DeclCheckState state) + void SemanticsVisitor::ensureDeclBase(DeclBase* declBase, DeclCheckState state, SemanticsContext* baseContext) { if(auto decl = as<Decl>(declBase)) { - ensureDecl(decl, state); + ensureDecl(decl, state, baseContext); } else if(auto declGroup = as<DeclGroup>(declBase)) { for(auto dd : declGroup->decls) { - ensureDecl(dd, state); + ensureDecl(dd, state, baseContext); } } else @@ -4398,6 +4398,17 @@ namespace Slang { ensureDecl(paramDecl, DeclCheckState::ReadyForReference); } + + auto errorType = decl->errorType; + if (errorType.exp) + { + errorType = CheckProperType(errorType); + } + else + { + errorType = TypeExp(m_astBuilder->getVoidType()); + } + decl->errorType = errorType; } void SemanticsDeclHeaderVisitor::visitFuncDecl(FuncDecl* funcDecl) |
