summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-parser.cpp
diff options
context:
space:
mode:
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);