-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Codegen overloaded function declarations (#352)
* Codegen overloaded function declarations * extract helper methods, handle 'declare fn' * Add ticket numbers to TODOs
- Loading branch information
1 parent
2dba351
commit 685f22a
Showing
19 changed files
with
457 additions
and
67 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
1 change: 1 addition & 0 deletions
1
src/Escalier.Codegen.Tests/snapshots/Tests.CodegenCalls.verified.txt
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
11 changes: 11 additions & 0 deletions
11
src/Escalier.Codegen.Tests/snapshots/Tests.CodegenFunctionDeclaration.verified.txt
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,11 @@ | ||
input: | ||
fn add(a: number, b: number) -> number { | ||
return a + b; | ||
} | ||
let sum = add(5, 10); | ||
|
||
output: | ||
function add(a, b) { | ||
return a + b; | ||
} | ||
var sum = add(5, 10); |
22 changes: 22 additions & 0 deletions
22
src/Escalier.Codegen.Tests/snapshots/Tests.CodegenFunctionOverloads.verified.txt
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,22 @@ | ||
input: | ||
fn add(a: number, b: number) -> number { | ||
return a + b; | ||
} | ||
fn add(a: string, b: string) -> string { | ||
return a ++ b; | ||
} | ||
let sum = add(5, 10); | ||
let msg = add("hello, ", "world"); | ||
|
||
output: | ||
function add(a, b) { | ||
if (typeof a == "number" && typeof b == "number") { | ||
return a + b; | ||
} else if (typeof a == "string" && typeof b == "string") { | ||
return a + b; | ||
} else { | ||
throw TypeError(); | ||
} | ||
} | ||
var sum = add(5, 10); | ||
var msg = add("hello, ", "world"); |
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
4 changes: 4 additions & 0 deletions
4
src/Escalier.Codegen.Tests/snapshots/Tests.CodegenLogicalOperators.verified.txt
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
2 changes: 2 additions & 0 deletions
2
src/Escalier.Codegen.Tests/snapshots/Tests.CodegenMemberAccess.verified.txt
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
Oops, something went wrong.