summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-parser.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-parser.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-parser.cpp')
-rw-r--r--source/slang/slang-parser.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp
index b2179c1af..38317009d 100644
--- a/source/slang/slang-parser.cpp
+++ b/source/slang/slang-parser.cpp
@@ -3105,7 +3105,11 @@ namespace Slang
static NodeBase* parseConstructorDecl(Parser* parser, void* /*userData*/)
{
ConstructorDecl* decl = parser->astBuilder->create<ConstructorDecl>();
- parser->FillPosition(decl);
+
+ // Note: we leave the source location of this decl as invalid, to
+ // trigger the fallback logic that fills in the location of the
+ // `__init` keyword later.
+
parser->PushScope(decl);
// TODO: we need to make sure that all initializers have
@@ -3132,6 +3136,7 @@ namespace Slang
AccessorDecl* decl = nullptr;
auto loc = peekToken(parser).loc;
+ auto name = peekToken(parser).getName();
if( AdvanceIf(parser, "get") )
{
decl = parser->astBuilder->create<GetterDecl>();
@@ -3150,6 +3155,8 @@ namespace Slang
return nullptr;
}
decl->loc = loc;
+ decl->nameAndLoc.name = name;
+ decl->nameAndLoc.loc = loc;
_addModifiers(decl, modifiers);