Skip to content

Commit

Permalink
Merge pull request #28 from readdle/fix/swift-compiler-warning-in-gen…
Browse files Browse the repository at this point in the history
…erated-code

Fix swift compiler warnings in generated code
  • Loading branch information
andriydruk authored Jan 30, 2021
2 parents 0bb2199 + d1fd323 commit c98b127
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,21 @@ public void generateCode(SwiftWriter swiftWriter, String javaFullName, String sw
swiftWriter.emitStatement(String.format("let %s: %s%s", param.name, param.swiftType.swiftType, param.isOptional ? "?" : ""));
}

boolean shouldCatchPreamble = params.size() > 0 || !isStatic;

boolean shouldCatchPreamble = false;
if (isStatic) {
for (SwiftParamDescriptor param : params) {
// primitive types constructors not throw
if (param.isOptional || !param.isPrimitive()) {
shouldCatchPreamble = true;
break;
}
}
}
else {
shouldCatchPreamble = true;
}

if (shouldCatchPreamble) {
swiftWriter.emitStatement("do {");
}
Expand Down

0 comments on commit c98b127

Please sign in to comment.