summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-20 13:57:20 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-20 13:57:20 -0700
commit4313db822ca468e33c765170c924bf031e5e66a5 (patch)
treea57809c3babf861933ed8e77aef2c54a38a0f712 /source
parent3d29c9029349ef2948dd6ae63c08c2ea2f4380dc (diff)
Add a useful source location to `typedef` declarations
This was just missing logic in the parser.
Diffstat (limited to 'source')
-rw-r--r--source/slang/parser.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp
index 5e06aa877..48954dc04 100644
--- a/source/slang/parser.cpp
+++ b/source/slang/parser.cpp
@@ -488,6 +488,9 @@ namespace Slang
RefPtr<TypeDefDecl> ParseTypeDef(Parser* parser)
{
+ RefPtr<TypeDefDecl> typeDefDecl = new TypeDefDecl();
+ typeDefDecl->Position = parser->tokenReader.PeekLoc();
+
// Consume the `typedef` keyword
parser->ReadToken("typedef");
@@ -496,7 +499,6 @@ namespace Slang
auto nameToken = parser->ReadToken(TokenType::Identifier);
- RefPtr<TypeDefDecl> typeDefDecl = new TypeDefDecl();
typeDefDecl->Name = nameToken;
typeDefDecl->Type = type;