From 4313db822ca468e33c765170c924bf031e5e66a5 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 20 Jun 2017 13:57:20 -0700 Subject: Add a useful source location to `typedef` declarations This was just missing logic in the parser. --- source/slang/parser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source') 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 ParseTypeDef(Parser* parser) { + RefPtr 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 = new TypeDefDecl(); typeDefDecl->Name = nameToken; typeDefDecl->Type = type; -- cgit v1.2.3