-
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(rosetta): newlines after return statements missing (#3063)
Handling of newlines was incorrect (and missing a terminating semicolon) around lines involving `return`s. Fix that, and fix correct handling of derived function return types while we're at it. Fixes #3054. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
- Loading branch information
Showing
14 changed files
with
165 additions
and
31 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
packages/jsii-rosetta/test/translations/statements/statements_and_newlines.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 @@ | ||
public int DoThing() | ||
{ | ||
int x = 1; // x seems to be equal to 1 | ||
return x + 1; | ||
} | ||
|
||
public boolean DoThing2(int x) | ||
{ | ||
if (x == 1) | ||
{ | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
public int DoThing3() | ||
{ | ||
int x = 1; | ||
return x + 1; | ||
} | ||
|
||
public void DoThing4() | ||
{ | ||
int x = 1; | ||
x = 85; | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/jsii-rosetta/test/translations/statements/statements_and_newlines.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,21 @@ | ||
public Number doThing() { | ||
Number x = 1; // x seems to be equal to 1 | ||
return x + 1; | ||
} | ||
|
||
public boolean doThing2(Number x) { | ||
if (x == 1) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
public Number doThing3() { | ||
Number x = 1; | ||
return x + 1; | ||
} | ||
|
||
public void doThing4() { | ||
Number x = 1; | ||
x = 85; | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/jsii-rosetta/test/translations/statements/statements_and_newlines.py
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,16 @@ | ||
def do_thing(): | ||
x = 1 # x seems to be equal to 1 | ||
return x + 1 | ||
|
||
def do_thing2(x): | ||
if x == 1: | ||
return True | ||
return False | ||
|
||
def do_thing3(): | ||
x = 1 | ||
return x + 1 | ||
|
||
def do_thing4(): | ||
x = 1 | ||
x = 85 |
21 changes: 21 additions & 0 deletions
21
packages/jsii-rosetta/test/translations/statements/statements_and_newlines.ts
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,21 @@ | ||
function doThing() { | ||
const x = 1; // x seems to be equal to 1 | ||
return x + 1; | ||
} | ||
|
||
function doThing2(x: number) { | ||
if (x == 1) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
function doThing3() { | ||
const x = 1; | ||
return x + 1; | ||
} | ||
|
||
function doThing4() { | ||
let x = 1; | ||
x = 85; | ||
} |