forked from gsvgit/Brahma.FSharp
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support of match expressions with bindings.
- Loading branch information
1 parent
36a7d89
commit 0098feb
Showing
5 changed files
with
140 additions
and
47 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
25 changes: 25 additions & 0 deletions
25
tests/Brahma.FSharp.Tests/UnionExpected/Union.Compile.Test7.cl
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,25 @@ | ||
typedef struct TranslateMatchTestUnion {int tag ; | ||
union TranslateMatchTestUnion_Data {struct Case2Type {int | ||
Item ;} | ||
Case2 ; | ||
struct Case3Type {int | ||
Item1 | ||
; | ||
int | ||
Item2 | ||
;} | ||
Case3 ;} data ;} TranslateMatchTestUnion | ||
; | ||
__kernel void brahmaKernel () | ||
{TranslateMatchTestUnion t = { 0 } ; | ||
int m = 5 ; | ||
if (((t) . tag == 1)) | ||
{int x = (((t) . data) . Case2) . Item ; | ||
m = x ;} | ||
else | ||
{if (((t) . tag == 2)) | ||
{int z = (((t) . data) . Case3) . Item2 ; | ||
int y = (((t) . data) . Case3) . Item1 ; | ||
m = (y + z) ;} | ||
else | ||
{m = 5 ;} ;} ;} |