Skip to content

Commit 130f0f7

Browse files
authored
Merge branch 'TASEmulators:master' into add-gameboy-memory-callback-values
2 parents b4c8d61 + fd36a37 commit 130f0f7

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

Directory.Packages.props

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
<PackageVersion Include="Menees.Analyzers" Version="3.0.10" />
99
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.33" />
1010
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
11-
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
12-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.0" />
11+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
1312
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
1413
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="8.0.1" />
1514
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />

ExternalProjects/AnalyzersCommon.props

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
</PropertyGroup>
1515
<ItemGroup>
1616
<EditorConfigFiles Include="$(MSBuildProjectDirectory)/../Analyzers.editorconfig" />
17-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" />
1817
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
1918
<Compile Include="$(MSBuildProjectDirectory)/../AnalyzersCommon/**/*.cs" />
2019
</ItemGroup>

ExternalProjects/BizHawk.Analyzer/FirstOrDefaultOnStructAnalyzer.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace BizHawk.Analyzers;
22

3+
using System;
34
using System.Collections.Immutable;
45
using System.Linq;
56

@@ -42,8 +43,13 @@ public override void Initialize(AnalysisContext context)
4243
var operation = (IInvocationOperation) oac.Operation;
4344
var calledSym = operation.TargetMethod.ConstructedFrom;
4445
if (!(firstOrDefaultWithPredSym!.Matches(calledSym) || firstOrDefaultNoPredSym!.Matches(calledSym))) return;
45-
var receiverExprType = (INamedTypeSymbol) operation.SemanticModel!.GetTypeInfo((CSharpSyntaxNode) operation.Arguments[0].Syntax)!.ConvertedType!;
46-
if (receiverExprType.TypeArguments[0].IsValueType) oac.ReportDiagnostic(Diagnostic.Create(DiagUseFirstOrNull, operation.Syntax.GetLocation()));
46+
var receiverExprType = operation.SemanticModel!.GetTypeInfo((CSharpSyntaxNode) operation.Arguments[0].Syntax).ConvertedType!;
47+
var collectionElemType = receiverExprType switch {
48+
INamedTypeSymbol nts => nts.TypeArguments[0],
49+
IArrayTypeSymbol ats => ats.ElementType,
50+
_ => throw new InvalidOperationException($"receiver parameter's effective type was of an unexpected kind (neither class/struct nor array): {receiverExprType}")
51+
};
52+
if (collectionElemType.IsValueType) oac.ReportDiagnostic(Diagnostic.Create(DiagUseFirstOrNull, operation.Syntax.GetLocation()));
4753
},
4854
OperationKind.Invocation);
4955
});

References/BizHawk.Analyzer.dll

512 Bytes
Binary file not shown.

src/BizHawk.Client.Common/movie/tasproj/TasBranch.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,10 @@ public static int IndexOfFrame(this IList<TasBranch> list, int frame)
292292
{
293293
// intentionally not using linq here because this is called many times per frame
294294
int index = -1;
295-
var timeStamp = DateTime.MaxValue;
295+
var timeStamp = DateTime.MinValue;
296296
for (int i = 0; i < list.Count; i++)
297297
{
298-
if (list[i].Frame == frame && list[i].TimeStamp < timeStamp)
298+
if (list[i].Frame == frame && list[i].TimeStamp > timeStamp)
299299
{
300300
index = i;
301301
timeStamp = list[i].TimeStamp;

0 commit comments

Comments
 (0)