-
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
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.
- Loading branch information
Showing
11 changed files
with
162 additions
and
28 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
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; | ||
} |