-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: accept variadic arguments after optional arguments (#307)
The following type signature is valid: function(optional?: string, ...args: string[]) The function can be called with anywhere from 0-infinity arguments.
- Loading branch information
Showing
8 changed files
with
162 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...PackageId/Amazon/JSII/Tests/CalculatorNamespace/DontComplainAboutVariadicAfterOptional.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Amazon.JSII.Runtime.Deputy; | ||
|
||
namespace Amazon.JSII.Tests.CalculatorNamespace | ||
{ | ||
[JsiiClass(typeof(DontComplainAboutVariadicAfterOptional), "jsii-calc.DontComplainAboutVariadicAfterOptional", "[]")] | ||
public class DontComplainAboutVariadicAfterOptional : DeputyBase | ||
{ | ||
public DontComplainAboutVariadicAfterOptional(): base(new DeputyProps(new object[]{})) | ||
{ | ||
} | ||
|
||
protected DontComplainAboutVariadicAfterOptional(ByRefValue reference): base(reference) | ||
{ | ||
} | ||
|
||
protected DontComplainAboutVariadicAfterOptional(DeputyProps props): base(props) | ||
{ | ||
} | ||
|
||
[JsiiMethod("optionalAndVariadic", "{\"primitive\":\"string\"}", "[{\"name\":\"optional\",\"type\":{\"primitive\":\"string\",\"optional\":true}},{\"name\":\"things\",\"type\":{\"primitive\":\"string\"}}]")] | ||
public virtual string OptionalAndVariadic(string optional, string things) | ||
{ | ||
return InvokeInstanceMethod<string>(new object[]{optional, things}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...in/java/software/amazon/jsii/tests/calculator/DontComplainAboutVariadicAfterOptional.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package software.amazon.jsii.tests.calculator; | ||
|
||
@javax.annotation.Generated(value = "jsii-pacmak") | ||
@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.DontComplainAboutVariadicAfterOptional") | ||
public class DontComplainAboutVariadicAfterOptional extends software.amazon.jsii.JsiiObject { | ||
protected DontComplainAboutVariadicAfterOptional(final software.amazon.jsii.JsiiObject.InitializationMode mode) { | ||
super(mode); | ||
} | ||
public DontComplainAboutVariadicAfterOptional() { | ||
super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii); | ||
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this); | ||
} | ||
|
||
public java.lang.String optionalAndVariadic(@javax.annotation.Nullable final java.lang.String optional, final java.lang.String... things) { | ||
return this.jsiiCall("optionalAndVariadic", java.lang.String.class, java.util.stream.Stream.concat(java.util.stream.Stream.of(optional), java.util.Arrays.stream(java.util.Objects.requireNonNull(things, "things is required"))).toArray()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters