-
-
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.
Merge pull request #260 from adrianoc/staging
Promoting staging to production (feb/2024)
- Loading branch information
Showing
1,380 changed files
with
491,431 additions
and
394,302 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<LangVersion>11</LangVersion> | ||
<AssemblyVersion>2.6.0</AssemblyVersion> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<LangVersion>12</LangVersion> | ||
<AssemblyVersion>2.8.0</AssemblyVersion> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
</Project> |
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,6 @@ | ||
<Project> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp"><Version>4.7.0-2.final</Version></PackageReference> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp"><Version>4.8.0</Version></PackageReference> | ||
<PackageReference Include="Mono.Cecil"><Version>0.11.5</Version></PackageReference> | ||
</ItemGroup> | ||
</Project> |
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
45 changes: 45 additions & 0 deletions
45
Cecilifier.Core.Tests/Tests/Unit/Miscellaneous.Assingment.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,45 @@ | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
|
||
namespace Cecilifier.Core.Tests.Tests.Unit | ||
{ | ||
[TestFixture] | ||
public class MiscellaneousAssignmentsTests : CecilifierUnitTestBase | ||
{ | ||
[TestCaseSource(nameof(TestScenarios))] | ||
public void TestIndirectLoad_Issue259(string typeName, string expectedLoadOpcode, bool initializeVariable) | ||
{ | ||
var code = $$""" | ||
struct S {} | ||
class Foo { {{typeName}} Bar(ref {{typeName}} p) { {{typeName}} local{{ (initializeVariable ? "" : "; local") }} = p; return local; } } | ||
"""; | ||
|
||
var expectedSnippet = @".*(?<emit>.+\.Emit\(OpCodes\.)Ldarg_1\);\s" | ||
+ $@"\1{expectedLoadOpcode}.+;\s" | ||
+ @"\1Stloc, l_local_\d+\);\s"; | ||
|
||
var result = RunCecilifier(code); | ||
Assert.That(result.GeneratedCode.ReadToEnd(), Does.Match(expectedSnippet)); | ||
} | ||
|
||
static IEnumerable<TestCaseData> TestScenarios() | ||
{ | ||
foreach(var initializeMode in new[] { true, false } ) | ||
{ | ||
yield return new TestCaseData("int", "Ldind_I4", initializeMode); | ||
yield return new TestCaseData("long", "Ldind_I8", initializeMode); | ||
yield return new TestCaseData("short", "Ldind_I2", initializeMode); | ||
yield return new TestCaseData("byte", "Ldind_U1", initializeMode); | ||
yield return new TestCaseData("float", "Ldind_R4", initializeMode); | ||
yield return new TestCaseData("double", "Ldind_R8", initializeMode); | ||
yield return new TestCaseData("bool", "Ldind_U1", initializeMode); | ||
yield return new TestCaseData("char", "Ldind_U2", initializeMode); | ||
yield return new TestCaseData("int[]", "Ldind_Ref", initializeMode); | ||
yield return new TestCaseData("System.DateTime", "Ldobj", initializeMode); | ||
yield return new TestCaseData("S", "Ldobj", initializeMode); | ||
} | ||
} | ||
|
||
public record struct TestScenario(string TypeName, string ExpectedLoadOpcode, bool VariableInitializer); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="../Cecilifier.Common.props" /> | ||
<Import Project="../Cecilifier.CommonPackages.props" /> | ||
|
||
<ItemGroup> | ||
<InternalsVisibleTo Include="$(AssemblyName).Tests"/> | ||
</ItemGroup> | ||
</Project> |
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,16 @@ | ||
using Microsoft.CodeAnalysis; | ||
|
||
namespace Cecilifier.Core.Misc; | ||
|
||
public record struct CompilationError(int StartLineNumber, int StartColumn, int EndLineNumber, int EndColumn, string Message) | ||
{ | ||
public static implicit operator CompilationError(Diagnostic diagnostic) | ||
{ | ||
var lineSpan = diagnostic.Location.GetLineSpan(); return new CompilationError( | ||
lineSpan.Span.Start.Line + 1, | ||
lineSpan.Span.Start.Character + 1, | ||
lineSpan.Span.End.Line + 1, | ||
lineSpan.Span.End.Character + 1, | ||
diagnostic.GetMessage()); | ||
} | ||
} |
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,11 +1,15 @@ | ||
using System; | ||
using Cecilifier.Core.Misc; | ||
|
||
namespace Cecilifier.Core | ||
{ | ||
public class SyntaxErrorException : Exception | ||
{ | ||
public SyntaxErrorException(string message) : base(message) | ||
public CompilationError[] Errors { get; } | ||
|
||
public SyntaxErrorException(CompilationError[] errors) | ||
{ | ||
Errors = errors; | ||
} | ||
} | ||
} |
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.