Skip to content

Commit

Permalink
Address comments from @grendello
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpryor committed Feb 15, 2023
1 parent 32e7f55 commit 1e1285e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public LambdaExpression CreateMarshalToManagedExpression (MethodInfo method, Jav
typeof (object),
typeof (IntPtr)
};
marshalDelegateTypes = new ();
marshalDelegateTypes = new (StringComparer.Ordinal);
}
if (marshalDelegateTypes!.TryGetValue (name, out var type)) {
return type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ protected override Expression VisitInvocation (

List<Instruction> GetFixupsForLabelTarget (LabelTarget target)
{
List<Instruction>? fixups;
if (!returnFixups.TryGetValue (target, out fixups)) {
if (!returnFixups.TryGetValue (target, out List<Instruction>? fixups)) {
returnFixups.Add (target, fixups = new ());
}
return fixups;
Expand All @@ -313,7 +312,7 @@ protected override Expression VisitLabel (
{
Logger (TraceLevel.Verbose, $"# jonp: CecilCompilerExpressionVisitor.VisitLabel: {node}");
var target = il.Body.Instructions.Last ();
if (returnFixups.TryGetValue (node.Target, out var fixups)) {
if (returnFixups.TryGetValue (node.Target, out List<Instruction>? fixups)) {
foreach (var replace in fixups) {
Logger (TraceLevel.Verbose, $"# jonp: VisitLabel: replacing instruction `{replace}` w/ `leave {target}");
Debug.Assert (replace.OpCode == OpCodes.Ret || replace.OpCode == OpCodes.Nop);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ void FillVariables (
var variableVisitor = new VariableExpressionVisitor (variables.Keys, Logger);
variableVisitor.Visit (e);

Console.WriteLine ($"# jonp: filling {variableVisitor.Variables.Count} variables");
Logger (TraceLevel.Verbose, $"# jonp: filling {variableVisitor.Variables.Count} variables");
for (int i = 0; i < variableVisitor.Variables.Count; ++i) {
var c = variableVisitor.Variables [i];
var d = new VariableDefinition (declaringAssembly.MainModule.ImportReference (c.Type));
Expand Down Expand Up @@ -397,7 +397,7 @@ void FillVariables (
if (c == variableVisitor.ReturnValue) {
ReturnValue = v;
}
Console.WriteLine ($"# jonp: FillVariables: local var {c.Name} is index {i}");
Logger (TraceLevel.Verbose, $"# jonp: FillVariables: local var {c.Name} is index {i}");
}
}
}
Expand Down

0 comments on commit 1e1285e

Please sign in to comment.