From cbd6559ddcba4d26079b378228521dacd41105f2 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 8 Apr 2024 11:47:53 +0800 Subject: [PATCH] - fix #374: Can't find the correct type if current symbol is member of a class that has constructors. --- NEWS.md | 1 + RedPandaIDE/parser/cppparser.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index f70516a1..a20c1038 100644 --- a/NEWS.md +++ b/NEWS.md @@ -128,6 +128,7 @@ Red Panda C++ Version 2.27 - enhancement: Size of icons in the completion popup changes with the editor font size. - change: Completion popup size settings are based on editor's char width/line height. - change: Remove "limit for copy" and "limit for undo" options. + - fix: Can't find the correct type if current symbol is member of a class that has constructors. Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 3325d1c9..4be20dda 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -2603,6 +2603,8 @@ PStatement CppParser::getTypeDef(const PStatement& statement, || statement->kind == StatementKind::EnumType || statement->kind == StatementKind::EnumClassType) { return statement; + } else if (statement->kind == StatementKind::Constructor) { + return statement->parentScope.lock(); } else if (statement->kind == StatementKind::Typedef) { if (statement->type == aType) // prevent infinite loop return statement;