Skip to content

Commit

Permalink
Fix: Ignoring perfect match (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
neolithos committed Nov 11, 2022
1 parent 3c02bc5 commit 157df5c
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ExtTest/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
2 changes: 1 addition & 1 deletion ExtTest/ExtTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ExtTest</RootNamespace>
<AssemblyName>ExtTest</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
Expand Down
2 changes: 1 addition & 1 deletion NeoCmd/NeoCmd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>NeoCmd</RootNamespace>
<TargetFramework>net47</TargetFramework>
<TargetFramework>net48</TargetFramework>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<StartupObject />
Expand Down
2 changes: 1 addition & 1 deletion NeoLua.Dbg/NeoLua.Dbg.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<None Include="..\NeoLua\NeoLua.licenseheader" Link="NeoLua.licenseheader" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DynamicLanguageRuntime" Version="1.2.2" />
<PackageReference Include="DynamicLanguageRuntime" Version="1.3.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NeoLua\NeoLua.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions NeoLua.Test/NeoLua.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
<EmbeddedResource Include="Lua\Runtime12.lua" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="1.3.2" />
<PackageReference Include="MSTest.TestFramework" Version="1.3.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
Expand Down
18 changes: 12 additions & 6 deletions NeoLua/LuaEmit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2235,6 +2235,12 @@ public void SetMatch(MemberMatchValue value, bool positional)

public bool IsBetter(MemberMatchInfo<TMEMBERTYPE> other) // is this better than other
{
if (IsPerfect)
{
Debug.WriteLine(" ==> IsPerfect");
return true;
}

if (other.IsPerfect)
{
Debug.WriteLine(" ==> other IsPerfect");
Expand All @@ -2243,7 +2249,7 @@ public bool IsBetter(MemberMatchInfo<TMEMBERTYPE> other) // is this better than

if (unboundedArguments && currentParameterLength > other.currentParameterLength)
{
Debug.WriteLine(" ==> other {0} && {1} > {2}", unboundedArguments, currentParameterLength, other.currentParameterLength);
Debug.WriteLine(" ==> other {unboundedArguments} && {currentParameterLength} > {other.currentParameterLength}");
return true;
}
else if (!unboundedArguments || currentParameterLength == other.currentParameterLength)
Expand Down Expand Up @@ -2340,7 +2346,7 @@ public MemberMatch(CallInfo callInfo, TARG[] arguments, Func<TARG, Type> getType
argsDebug.Append(callInfo.ArgumentNames[argNameIndex]).Append(": ");
argsDebug.Append(getType(arguments[i]));
}
Debug.WriteLine("Call: {0}", argsDebug.ToString());
Debug.WriteLine($"Call: {argsDebug}");
#endif

// choose the algorithm
Expand All @@ -2354,17 +2360,17 @@ public MemberMatch(CallInfo callInfo, TARG[] arguments, Func<TARG, Type> getType
else
resetAlgorithm = ResetNamed;

Debug.WriteLine("Algorithm: {0}", resetAlgorithm.GetMethodInfo().Name);
Debug.WriteLine($"Algorithm: {resetAlgorithm.GetMethodInfo().Name}");
} // ctor

public void Reset(TMEMBERTYPE member, bool isMemberCall, MemberMatchInfo<TMEMBERTYPE> target)
{
Debug.WriteLine("Reset member: {0}", member);
Debug.WriteLine($"Reset member: {member}");

var parameterInfo = GetMemberParameter(member, isMemberCall);
target.Reset(member, parameterInfo);
resetAlgorithm(parameterInfo, target);
Debug.WriteLine(" Result: {0}", target);
Debug.WriteLine($" Result: {target}");
} // proc Reset

private static ParameterInfo[] GetMemberParameter(TMEMBERTYPE mi, bool isMemberCall)
Expand Down Expand Up @@ -2583,7 +2589,7 @@ public static TMEMBERTYPE FindMember<TMEMBERTYPE, TARG>(IEnumerable<TMEMBERTYPE>
}
}

Debug.WriteLine("USED: {0}", memberMatchBind.CurrentMember);
Debug.WriteLine($"USED: {memberMatchBind.CurrentMember}");

return memberMatchBind.CurrentMember;
}
Expand Down
2 changes: 1 addition & 1 deletion NeoLua/NeoLua.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This library contains the desktop parts of the lua implementation.</PackageRelea
<EmbeddedResource Include="NeoLua.snk" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
Expand Down

0 comments on commit 157df5c

Please sign in to comment.