diff options
Diffstat (limited to 'source/slang/slang-syntax.cpp')
| -rw-r--r-- | source/slang/slang-syntax.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp index 6fdd5088a..e479f1b9d 100644 --- a/source/slang/slang-syntax.cpp +++ b/source/slang/slang-syntax.cpp @@ -284,7 +284,18 @@ SourceLoc getDiagnosticPos(DeclRefBase* declRef) { if (!declRef) return SourceLoc(); - return declRef->getDecl()->loc; + return getDiagnosticPos(declRef->getDecl()); +} + +SourceLoc getDiagnosticPos(Decl* decl) +{ + if (!decl) + return SourceLoc(); + if (decl->getNameLoc().isValid()) + { + return decl->getNameLoc(); + } + return decl->loc; } // !!!!!!!!!!!!!!!!!!!!!!!!!!!!! Free functions !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
