summaryrefslogtreecommitdiff
path: root/source/slang/slang-serialize-container.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-06-13 12:20:35 -0700
committerGitHub <noreply@github.com>2022-06-13 12:20:35 -0700
commitc90c6ab750ab05dd6d337e4f857958b8f3d00153 (patch)
tree569085637c5d3de33d7aaec8ab8c0e84be49bfd0 /source/slang/slang-serialize-container.cpp
parent68d9d87f9385a8c7c29443dcfcbf70434dc889bd (diff)
Language Server improvements. (#2269)
* Language Server improvements. - Improve parser robustness around `attribute_syntax`. - Exclude instance members in a static query. - Coloring accessors - Improved signature help cursor range check. * Add expected test result. * Language server: support configuring predefined macros. * Fix constructor highlighting. * Improving performance by supporting incremental text change notifications. * Fix UTF16 positions and highlighting of constructor calls. * Add completion suggestions for HLSL semantics. * Fix tests. * Fix: don't skip static variables in a static query. * Include literal init expr value in hover text. * Fix scenarios where completion failed to trigger. * Fixing language server protocol field initializations. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-serialize-container.cpp')
-rw-r--r--source/slang/slang-serialize-container.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/source/slang/slang-serialize-container.cpp b/source/slang/slang-serialize-container.cpp
index 344b4aa02..09aea6c8b 100644
--- a/source/slang/slang-serialize-container.cpp
+++ b/source/slang/slang-serialize-container.cpp
@@ -350,7 +350,7 @@ static List<ExtensionDecl*>& _getCandidateExtensionList(
{
auto startChunk = chunk;
- RefPtr<ASTBuilder> astBuilder;
+ RefPtr<ASTBuilder> astBuilder = options.astBuilder;
NodeBase* astRootNode = nullptr;
RefPtr<IRModule> irModule;
@@ -385,8 +385,10 @@ static List<ExtensionDecl*>& _getCandidateExtensionList(
StringBuilder buf;
buf << "tu" << out.modules.getCount();
-
- astBuilder = new ASTBuilder(options.sharedASTBuilder, buf.ProduceString());
+ if (!astBuilder)
+ {
+ astBuilder = new ASTBuilder(options.sharedASTBuilder, buf.ProduceString());
+ }
DefaultSerialObjectFactory objectFactory(astBuilder);
@@ -419,7 +421,7 @@ static List<ExtensionDecl*>& _getCandidateExtensionList(
{
UnownedStringSlice mangledName = reader.getStringSlice(SerialIndex(i));
- UnownedStringSlice moduleName;
+ String moduleName;
SLANG_RETURN_ON_FAIL(MangledNameParser::parseModuleName(mangledName, moduleName));
// If we already have looked up this module and it has the same name just use what we have
@@ -457,8 +459,11 @@ static List<ExtensionDecl*>& _getCandidateExtensionList(
options.sink->diagnose(SourceLoc::fromRaw(0), Diagnostics::unableToFindSymbolInModule, mangledName, moduleName);
}
- // If didn't find the export then we are done
- return SLANG_FAIL;
+ // If didn't find the export then we create an UnresolvedDecl node to represent the error.
+ auto unresolved = astBuilder->create<UnresolvedDecl>();
+ unresolved->nameAndLoc.name =
+ options.linkage->getNamePool()->getName(mangledName);
+ nodeBase = unresolved;
}
// set the result