diff options
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index b03126512..ab3335bfb 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -16,6 +16,7 @@ #include "slang-ast-reflect.h" #include "slang-ast-synthesis.h" #include "slang-lookup.h" +#include "slang-parser.h" #include "slang-syntax.h" #include <limits> @@ -4558,6 +4559,7 @@ void SemanticsVisitor::addRequiredParamsToSynthesizedDecl( synMemberExpr->elementIndices.add((uint32_t)i); synMemberExpr->type = elementType; synMemberExpr->type.isLeftValue = paramType.isLeftValue; + synMemberExpr->checked = true; synArgs.add(synMemberExpr); } } @@ -8165,6 +8167,7 @@ SemanticsContext SemanticsDeclBodyVisitor::registerDifferentiableTypesForFunc( void SemanticsDeclBodyVisitor::visitFunctionDeclBase(FunctionDeclBase* decl) { auto newContext = registerDifferentiableTypesForFunc(decl); + decl->body = maybeParseStmt(decl->body, newContext); if (const auto body = decl->body) { checkStmt(decl->body, newContext); @@ -9472,6 +9475,28 @@ void SemanticsDeclBodyVisitor::visitAggTypeDecl(AggTypeDecl* aggTypeDecl) } } +Stmt* SemanticsVisitor::maybeParseStmt(Stmt* stmt, const SemanticsContext& context) +{ + if (auto unparsedStmt = as<UnparsedStmt>(stmt)) + { + // Parse the statement now, and check it. + SemanticsVisitor subVisitor(context); + TokenList tokenList; + tokenList.m_tokens = _Move(unparsedStmt->tokens); + return parseUnparsedStmt( + m_astBuilder, + &subVisitor, + getShared()->getTranslationUnitRequest(), + unparsedStmt->sourceLanguage, + unparsedStmt->isInVariadicGenerics, + tokenList, + getShared()->getSink(), + unparsedStmt->currentScope, + unparsedStmt->outerScope); + } + return stmt; +} + void SemanticsDeclHeaderVisitor::cloneModifiers(Decl* dest, Decl* src) { dest->modifiers = src->modifiers; @@ -11182,6 +11207,9 @@ static void _dispatchDeclCheckingVisitor(Decl* decl, DeclCheckState state, Seman { switch (state) { + case DeclCheckState::ReadyForParserLookup: + // We don't need to do anything to make a decl ready for parser lookup. + break; case DeclCheckState::ModifiersChecked: SemanticsDeclModifiersVisitor(shared).dispatch(decl); break; |
