From 5a623ec227726ad1d988a5d91f55f19b62a98e03 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 15 Feb 2024 00:05:51 -0800 Subject: Support loading serialized modules. (#3588) * Support loading serialized modules. * Fix. * Fix vs solution files * Fix glsl module loading. * C++ fix. * Fix. * Try fix c++ error. * Try fix. * Fix. * Fix. --- source/slang/slang-parser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-parser.cpp') diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp index 45fa5a125..477b43726 100644 --- a/source/slang/slang-parser.cpp +++ b/source/slang/slang-parser.cpp @@ -1280,21 +1280,24 @@ namespace Slang Parser* parser, void* /*userData*/) { auto decl = parser->astBuilder->create(); + auto moduleDecl = parser->getCurrentModuleDecl(); if (parser->LookAheadToken(TokenType::Identifier)) { auto nameToken = parser->ReadToken(TokenType::Identifier); decl->nameAndLoc.name = parser->getNamePool()->getName(nameToken.getContent()); decl->nameAndLoc.loc = nameToken.loc; + if (moduleDecl) moduleDecl->nameAndLoc = decl->nameAndLoc; } else if (parser->LookAheadToken(TokenType::StringLiteral)) { auto nameToken = parser->ReadToken(TokenType::StringLiteral); decl->nameAndLoc.name = parser->getNamePool()->getName(getStringLiteralTokenValue(nameToken)); decl->nameAndLoc.loc = nameToken.loc; + if (moduleDecl) moduleDecl->nameAndLoc = decl->nameAndLoc; } else { - if (auto moduleDecl = parser->getCurrentModuleDecl()) + if (moduleDecl) decl->nameAndLoc.name = moduleDecl->getName(); decl->nameAndLoc.loc = parser->tokenReader.peekLoc(); } -- cgit v1.2.3