From 4070362cdc97640b8220747aa16cc8217ce696de Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 21 Jun 2023 19:30:02 +0800 Subject: [PATCH] - enhancement: improve parsing result for function parameters like 'Node (&node)[10]' --- NEWS.md | 1 + RedPandaIDE/parser/cppparser.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/NEWS.md b/NEWS.md index bfbd0cf3..d0c43878 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,7 @@ Red Panda C++ Version 2.23 - enhancement: improve code completion for std iterators defined with "using namespace std" - enhancement: improve pointer calculation when inferencing type info - enhancement: improve parsing for multiple vars defined in one line + - enhancement: improve parsing result for function parameters like 'Node (&node)[10]' Red Panda C++ Version 2.22 diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 7890ea6b..9ac96af8 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -5554,6 +5554,12 @@ void CppParser::scanMethodArgs(const PStatement& functionStatement, int argStart QString cmd=mTokenizer[i]->text; words.append(cmd); i++; + } else if (mTokenizer[i]->text.startsWith("[")) { + if (!words.isEmpty()) { + int lastIdx=words.count()-1; + words[lastIdx]=words[lastIdx]+mTokenizer[i]->text; + } + i++; } else { i++; }