-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements enhancement #64
- Loading branch information
Showing
11 changed files
with
176 additions
and
54 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
Cecilifier.Core.Tests/TestResources/Integration/Misc/Pointers/FunctionPointers.cs.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,21 @@ | ||
unsafe class FunctionPointers | ||
{ | ||
static int F() => 10; | ||
static int F2(string s) => s.Length; | ||
|
||
void TestIntFunction() | ||
{ | ||
delegate*<int> fp = &F; | ||
//System.Console.Write(fp == null); | ||
|
||
System.Console.Write(fp()); | ||
} | ||
|
||
int TestIntFunctionWithParameters() | ||
{ | ||
delegate*<string, int> fp = &F2; | ||
System.Console.WriteLine(fp == null); | ||
return 0; | ||
//return fp("test"); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...er.Core.Tests/TestResources/Integration/Misc/Pointers/FunctionPointersAsParameters.cs.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,9 @@ | ||
unsafe class FunctionPointersAsParameters | ||
{ | ||
static int F() => 10; | ||
|
||
int TestFunctionPointerAsParameter(delegate*<int> func) | ||
{ | ||
return func() + TestFunctionPointerAsParameter(&F); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Cecilifier.Core.Tests/TestResources/Integration/Misc/Pointers/GenericFunctionPointers.cs.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,13 @@ | ||
unsafe class GenericFunctionPointers | ||
{ | ||
static T Identity<T>(T t) => t; | ||
|
||
void TestGenericFunctionPointer() | ||
{ | ||
delegate*<int,int> fp = &Identity<int>; | ||
System.Console.Write(fp(1)); | ||
|
||
delegate*<int,int> fp2 = &Identity; | ||
System.Console.Write(fp2(2)); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Cecilifier.Core.Tests/TestResources/Integration/Misc/Pointers/VoidFunctionPointers.cs.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,10 @@ | ||
unsafe class VoidFunctionPointers | ||
{ | ||
static void F() {} | ||
|
||
void TestVoidFunction() | ||
{ | ||
delegate*<void> fp = &F; | ||
fp(); | ||
} | ||
} |
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