diff --git a/badges/coverage-branches.svg b/badges/coverage-branches.svg index 2d77dd3..15a0d45 100644 --- a/badges/coverage-branches.svg +++ b/badges/coverage-branches.svg @@ -1 +1 @@ -branches: 49.51%branches49.51% \ No newline at end of file +branches: 49.23%branches49.23% \ No newline at end of file diff --git a/badges/coverage-functions.svg b/badges/coverage-functions.svg index 71afea2..da398d9 100644 --- a/badges/coverage-functions.svg +++ b/badges/coverage-functions.svg @@ -1 +1 @@ -functions: 59.15%functions59.15% \ No newline at end of file +functions: 59.23%functions59.23% \ No newline at end of file diff --git a/badges/coverage-jest coverage.svg b/badges/coverage-jest coverage.svg index 8e21027..03ac6b8 100644 --- a/badges/coverage-jest coverage.svg +++ b/badges/coverage-jest coverage.svg @@ -1 +1 @@ -jest coverage: 59.81%jest coverage59.81% \ No newline at end of file +jest coverage: 59.78%jest coverage59.78% \ No newline at end of file diff --git a/badges/coverage-lines.svg b/badges/coverage-lines.svg index 19e2f42..c930a64 100644 --- a/badges/coverage-lines.svg +++ b/badges/coverage-lines.svg @@ -1 +1 @@ -lines: 65.45%lines65.45% \ No newline at end of file +lines: 65.5%lines65.5% \ No newline at end of file diff --git a/badges/coverage-statements.svg b/badges/coverage-statements.svg index 6b09482..a3a99ec 100644 --- a/badges/coverage-statements.svg +++ b/badges/coverage-statements.svg @@ -1 +1 @@ -statements: 65.12%statements65.12% \ No newline at end of file +statements: 65.17%statements65.17% \ No newline at end of file diff --git a/dist/transpiler.cjs b/dist/transpiler.cjs index 089f2ce..3ddb31f 100644 --- a/dist/transpiler.cjs +++ b/dist/transpiler.cjs @@ -522,7 +522,7 @@ var BaseTranspiler = class { const name = this.printNode(node.name, 0); const initializer = node.initializer; let type = this.printParameterType(node); - type = type ? type : ""; + type = type ? type + " " : ""; if (defaultValue) { if (initializer) { const customDefaultValue = this.printCustomDefaultValueIfNeeded(initializer); @@ -2889,6 +2889,22 @@ var CSharpTranspiler = class extends BaseTranspiler { } return this.printNode(node.expression, identation); } + printParameter(node, defaultValue = true) { + const name = this.printNode(node.name, 0); + const initializer = node.initializer; + let type = this.printParameterType(node); + type = type ? type : ""; + if (defaultValue) { + if (initializer) { + const customDefaultValue = this.printCustomDefaultValueIfNeeded(initializer); + const defaultValue2 = customDefaultValue ? customDefaultValue : this.printNode(initializer, 0); + type = defaultValue2 === "null" && type !== "object" ? type + "? " : type + " "; + return type + name + this.SPACE_DEFAULT_PARAM + "=" + this.SPACE_DEFAULT_PARAM + defaultValue2; + } + return type + " " + name; + } + return name; + } printArrayLiteralExpression(node) { let arrayOpen = this.ARRAY_OPENING_TOKEN; const elems = node.elements; diff --git a/dist/transpiler.d.ts b/dist/transpiler.d.ts index 6c2f363..b2459cb 100644 --- a/dist/transpiler.d.ts +++ b/dist/transpiler.d.ts @@ -460,6 +460,7 @@ declare class CSharpTranspiler extends BaseTranspiler { printFunctionBody(node: any, identation: any): string; printInstanceOfExpression(node: any, identation: any): string; printAsExpression(node: any, identation: any): string; + printParameter(node: any, defaultValue?: boolean): string; printArrayLiteralExpression(node: any): string; printMethodDefinition(node: any, identation: any): string; printArgsForCallExpression(node: any, identation: any): any; diff --git a/dist/transpiler.js b/dist/transpiler.js index 37befb1..82e8a23 100644 --- a/dist/transpiler.js +++ b/dist/transpiler.js @@ -528,7 +528,7 @@ var BaseTranspiler = class { const name = this.printNode(node.name, 0); const initializer = node.initializer; let type = this.printParameterType(node); - type = type ? type : ""; + type = type ? type + " " : ""; if (defaultValue) { if (initializer) { const customDefaultValue = this.printCustomDefaultValueIfNeeded(initializer); @@ -2895,6 +2895,22 @@ var CSharpTranspiler = class extends BaseTranspiler { } return this.printNode(node.expression, identation); } + printParameter(node, defaultValue = true) { + const name = this.printNode(node.name, 0); + const initializer = node.initializer; + let type = this.printParameterType(node); + type = type ? type : ""; + if (defaultValue) { + if (initializer) { + const customDefaultValue = this.printCustomDefaultValueIfNeeded(initializer); + const defaultValue2 = customDefaultValue ? customDefaultValue : this.printNode(initializer, 0); + type = defaultValue2 === "null" && type !== "object" ? type + "? " : type + " "; + return type + name + this.SPACE_DEFAULT_PARAM + "=" + this.SPACE_DEFAULT_PARAM + defaultValue2; + } + return type + " " + name; + } + return name; + } printArrayLiteralExpression(node) { let arrayOpen = this.ARRAY_OPENING_TOKEN; const elems = node.elements;