-
-
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.
add support for fixed statement (single var)
- Loading branch information
Showing
9 changed files
with
131 additions
and
15 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
Cecilifier.Core.Tests/TestResources/Integration/Statements/FixedStatement.cs.il.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,7 @@ | ||
.locals (System.Int32& V_0) | ||
IL_0000: ldarg.0 | ||
IL_0001: ldflda System.Int32 FixedStatementTest::i | ||
IL_0006: stloc V_0 | ||
IL_000a: ldloc V_0 | ||
IL_000e: conv.u | ||
IL_000f: ret |
13 changes: 9 additions & 4 deletions
13
Cecilifier.Core.Tests/TestResources/Integration/Statements/FixedStatement.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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
|
||
unsafe void FixedStatement() | ||
class FixedStatementTest | ||
{ | ||
int i = 0; | ||
fixed (int* p = &i) { } | ||
public int i; | ||
unsafe int* FixedStatement() | ||
{ | ||
fixed (int* p = &i) | ||
{ | ||
return p; | ||
} | ||
} | ||
} |
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,14 @@ | ||
using NUnit.Framework; | ||
|
||
namespace Cecilifier.Core.Tests.Integration | ||
{ | ||
[TestFixture] | ||
public class StatementTests : IntegrationResourceBasedTest | ||
{ | ||
[Test] | ||
public void TestFixedStatement() | ||
{ | ||
AssertResourceTestWithExplicitExpectation(@"Statements/FixedStatement", "System.Int32* FixedStatementTest::FixedStatement()"); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
|
||
namespace Cecilifier.Core.Misc | ||
{ | ||
internal class ContextFlagReseter : IDisposable | ||
{ | ||
private readonly CecilifierContext _context; | ||
private readonly string _flagName; | ||
|
||
public ContextFlagReseter(CecilifierContext context, string flagName) | ||
{ | ||
_context = context; | ||
_flagName = flagName; | ||
_context.SetFlag(flagName); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_context.ClearFlag(_flagName); | ||
} | ||
} | ||
} |