summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2019-10-08 21:52:10 +0200
committerChristoph Schlosser <christophschlosser@users.noreply.github.com>2019-10-08 22:04:49 +0200
commita5b9a5497abd07c157c8faa5af17a3a16ffe90ad (patch)
treef6ee41c61a43ec55bdd546162af9b665a1b96a47
parent3c16da1b09b4a7490e2139d1ee3b96e4ed096806 (diff)
downloaddoxdocgen-a5b9a5497abd07c157c8faa5af17a3a16ffe90ad.tar.gz
Don’t use unnecessary variables
-rw-r--r--src/Lang/Cpp/CppParser.ts9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/Lang/Cpp/CppParser.ts b/src/Lang/Cpp/CppParser.ts
index 3b13721..dcdfcba 100644
--- a/src/Lang/Cpp/CppParser.ts
+++ b/src/Lang/Cpp/CppParser.ts
@@ -400,8 +400,7 @@ export default class CppParser implements ICodeParser {
while (linesToGet-- > 0) { // Check for end of expression.
nextLine = new Position(nextLine.line + 1, nextLine.character);
nextLineTxt = this.activeEditor.document.lineAt(nextLine.line).text.trim();
- let finalSlice = 0;
- let endOfDeclaration = false;
+ let finalSlice = -1;
// Check if method has finished if curly brace is opened while
// nesting is occuring.
@@ -412,13 +411,11 @@ export default class CppParser implements ICodeParser {
currentNest--;
} else if (nextLineTxt[i] === "{" && currentNest === 0) {
finalSlice = i;
- endOfDeclaration = true;
break;
} else if ((nextLineTxt[i] === ";"
|| (nextLineTxt[i] === ":" && nextLineTxt[i - 1] !== ":" && nextLineTxt[i + 1] !== ":"))
&& currentNest === 0) {
finalSlice = i;
- endOfDeclaration = true;
break;
}
}
@@ -431,7 +428,7 @@ export default class CppParser implements ICodeParser {
if (!this.isVsCodeAutoComplete(nextLineTxt)) {
logicalLine += "\n";
- if (endOfDeclaration === true) {
+ if (finalSlice >= 0) {
logicalLine += nextLineTxt.slice(0, finalSlice);
} else {
logicalLine += nextLineTxt;
@@ -439,7 +436,7 @@ export default class CppParser implements ICodeParser {
logicalLine.replace(/\*\//g, "");
}
- if (endOfDeclaration) {
+ if (finalSlice >= 0) {
return logicalLine.replace(/^\s+|\s+$/g, "");
}
}