summaryrefslogtreecommitdiffstats
path: root/src/Lang
diff options
context:
space:
mode:
authorRowan Goemans <RB.Goemans@student.han.nl>2017-12-31 02:54:54 +0100
committerChristoph Schlosser <christophschlosser@users.noreply.github.com>2018-02-20 22:02:22 +0100
commit16e4ed410f2bc29e528bf6ec872bdf92478749a7 (patch)
tree9f9a661c150460de78fc8f88796158d2cb32f362 /src/Lang
parent1746f21bc3720585d2fe877db8d69aae301ff02c (diff)
downloaddoxdocgen-16e4ed410f2bc29e528bf6ec872bdf92478749a7.tar.gz
-- Added test for constructors and destructors.
-- Removed config value for null on bool pointer return. I think it's to confusing for users. -- Fixed some small remaining refactor bugs.
Diffstat (limited to 'src/Lang')
-rw-r--r--src/Lang/C/CDocGen.ts17
-rw-r--r--src/Lang/C/CParser.ts2
2 files changed, 7 insertions, 12 deletions
diff --git a/src/Lang/C/CDocGen.ts b/src/Lang/C/CDocGen.ts
index 87d59fb..5488020 100644
--- a/src/Lang/C/CDocGen.ts
+++ b/src/Lang/C/CDocGen.ts
@@ -56,7 +56,7 @@ export default class CDocGen implements IDocGen {
***************************************************************************/
protected getIndentation(): string {
const line: TextLine = this.activeEditor.document.lineAt(this.activeEditor.selection.start.line);
- return line.text.slice(0, line.firstNonWhitespaceCharacterIndex);
+ return line.text.slice(0, line.firstNonWhitespaceCharacterIndex - 1);
}
protected getTemplatedString(replace: string, template: string, param: string): string {
@@ -72,7 +72,7 @@ export default class CDocGen implements IDocGen {
templateWith.forEach((element: string) => {
// Ignore null values
- if (element !== null && element !== undefined && element !== "") {
+ if (element !== null) {
line = this.cfg.commentPrefix;
line += this.getTemplatedString(replace, template, element);
lines.push(line);
@@ -95,14 +95,9 @@ export default class CDocGen implements IDocGen {
const boolReturnIndex: number = this.func.type.nodes
.findIndex((n) => n instanceof CToken && n.type === CTokenType.Symbol && n.value === "bool");
- if (boolReturnIndex !== -1) {
- if (this.cfg.boolReturnsTrueFalse === true) {
- params.push("true");
- params.push("false");
- }
- if (ptrReturnIndex !== -1 && this.cfg.boolPointerReturnsNull === true) {
- params.push("null");
- }
+ if (boolReturnIndex !== -1 && this.cfg.boolReturnsTrueFalse === true) {
+ params.push("true");
+ params.push("false");
} else if (voidReturnIndex !== -1 && ptrReturnIndex !== -1) {
params.push(this.cfg.includeTypeAtReturn === true ? this.func.type.Yield() : "");
} else if (voidReturnIndex === -1 && this.func.type.nodes.length > 0) {
@@ -130,7 +125,7 @@ export default class CDocGen implements IDocGen {
this.generateFromTemplate(
lines,
this.cfg.paramTemplateReplace,
- this.cfg.paramTemplate,
+ this.cfg.tparamTemplate,
this.templateParams,
);
if (this.cfg.newLineAfterTParams === true) {
diff --git a/src/Lang/C/CParser.ts b/src/Lang/C/CParser.ts
index 6d3d85b..859dc6b 100644
--- a/src/Lang/C/CParser.ts
+++ b/src/Lang/C/CParser.ts
@@ -297,7 +297,7 @@ export default class CParser implements ICodeParser {
const func = this.GetArgument(tree);
// check if it is a constructor or descructor since these have no name..
// and reverse the assignment of type and name.
- if (func.name === undefined) {
+ if (func.name === null) {
if (func.type.nodes.length !== 1) {
throw new Error("Too many symbols found for constructor/descructor.");
} else if (func.type.nodes[0] instanceof CParseTree) {