diff options
| author | Yong He <yonghe@outlook.com> | 2024-02-15 00:05:51 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-15 00:05:51 -0800 |
| commit | 5a623ec227726ad1d988a5d91f55f19b62a98e03 (patch) | |
| tree | 94a3fd2f00ce1a95035f39cd3571c9e97a70d24e /source/slang/slang-parser.cpp | |
| parent | 2ced683f10fb82f63a2e2c3d7b5f099c53bb57b0 (diff) | |
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.
Diffstat (limited to 'source/slang/slang-parser.cpp')
| -rw-r--r-- | source/slang/slang-parser.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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<ModuleDeclarationDecl>(); + 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(); } |
