Skip to content

Commit 21a80a5

Browse files
author
Maksim Volkau
committed
fixed the source linking debugging issue - huraaaah!; and unneeded parens too
1 parent bf9ae22 commit 21a80a5

4 files changed

Lines changed: 22 additions & 23 deletions

File tree

.vscode/launch.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
"preLaunchTask": "build_testsrunner",
1212
// If you have changed target frameworks, make sure to update the program path.
1313
"program": "${workspaceFolder}/test/FastExpressionCompiler.TestsRunner/bin/Debug/net9.0/FastExpressionCompiler.TestsRunner.dll",
14-
"args": [
15-
"/p:UseSourceLink=false"
16-
],
14+
"args": [],
1715
"cwd": "${workspaceFolder}/test/FastExpressionCompiler.TestsRunner",
1816
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
1917
"console": "internalConsole",

.vscode/tasks.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"type": "process",
88
"args": [
99
"build",
10-
"${workspaceFolder}/test/FastExpressionCompiler.TestsRunner/FastExpressionCompiler.TestsRunner.csproj"
10+
"${workspaceFolder}/test/FastExpressionCompiler.TestsRunner/FastExpressionCompiler.TestsRunner.csproj",
11+
"/p:EnableSourceLink=false",
12+
"/p:ContinuousIntegrationBuild=false"
1113
],
1214
"problemMatcher": "$msCompile",
1315
"group": {
@@ -21,7 +23,9 @@
2123
"type": "process",
2224
"args": [
2325
"build",
24-
"${workspaceFolder}/test/FastExpressionCompiler.Benchmarks/FastExpressionCompiler.Benchmarks.csproj"
26+
"${workspaceFolder}/test/FastExpressionCompiler.Benchmarks/FastExpressionCompiler.Benchmarks.csproj",
27+
"/p:EnableSourceLink=false",
28+
"/p:ContinuousIntegrationBuild=false"
2529
],
2630
"problemMatcher": "$msCompile",
2731
"group": {

src/FastExpressionCompiler/TestTools.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,9 @@ public static void PrintExpression(this Expression expr, bool completeTypeNames
7878
if (!AllowPrintExpression) return;
7979
Console.WriteLine();
8080
Console.WriteLine($"//{Path.GetFileNameWithoutExtension(filePath)}.{caller}");
81-
Console.WriteLine(
82-
expr.ToExpressionString(out var _, out var _, out var _,
83-
stripNamespace: true,
84-
printType: completeTypeNames ? null : CodePrinter.PrintTypeStripOuterClasses,
85-
indentSpaces: 4)
86-
);
81+
var printType = completeTypeNames ? null : CodePrinter.PrintTypeStripOuterClasses;
82+
var exprStr = expr.ToExpressionString(out var _, out var _, out var _, stripNamespace: true, indentSpaces: 4, printType: printType);
83+
Console.WriteLine(exprStr);
8784
}
8885

8986
public static void PrintExpression(this IDelegateDebugInfo debugInfo, bool completeTypeNames = false,
@@ -103,11 +100,8 @@ public static void PrintCSharp(this Expression expr, bool completeTypeNames = fa
103100
}
104101
var sb = new StringBuilder(1024);
105102
sb.Append("var @cs = ");
106-
sb = expr.ToCSharpString(sb,
107-
lineIndent: 0,
108-
stripNamespace: stripNamespace,
109-
printType: completeTypeNames ? null : CodePrinter.PrintTypeStripOuterClasses,
110-
indentSpaces: 4);
103+
var printType = completeTypeNames ? null : CodePrinter.PrintTypeStripOuterClasses;
104+
sb = expr.ToCSharpString(sb, ToCSharpPrinter.EnclosedIn.AvoidParens, stripNamespace: stripNamespace, printType: printType);
111105
sb.AppendSemicolonOnce();
112106
Console.WriteLine(sb.ToString());
113107
}
@@ -125,7 +119,8 @@ public static void PrintCSharp(this Expression expr, Func<string, string> transf
125119
}
126120
var sb = new StringBuilder(1024);
127121
sb.Append("var @cs = ");
128-
sb = expr.ToCSharpString(sb, ToCSharpPrinter.EnclosedIn.AvoidParens, stripNamespace: stripNamespace).AppendSemicolonOnce();
122+
sb = expr.ToCSharpString(sb, ToCSharpPrinter.EnclosedIn.AvoidParens, stripNamespace: stripNamespace);
123+
sb.AppendSemicolonOnce();
129124
var str = transform(sb.ToString());
130125
Console.WriteLine(str);
131126
}
@@ -143,7 +138,8 @@ public static void PrintCSharp(this Expression expr, CodePrinter.ObjectToCode ob
143138
}
144139
var sb = new StringBuilder(1024);
145140
sb.Append("var @cs = ");
146-
sb = expr.ToCSharpString(sb, ToCSharpPrinter.EnclosedIn.AvoidParens, notRecognizedToCode: objectToCode, stripNamespace: stripNamespace).AppendSemicolonOnce();
141+
sb = expr.ToCSharpString(sb, ToCSharpPrinter.EnclosedIn.AvoidParens, notRecognizedToCode: objectToCode, stripNamespace: stripNamespace);
142+
sb.AppendSemicolonOnce();
147143
var str = sb.ToString();
148144
Console.WriteLine(str);
149145
}
@@ -161,7 +157,8 @@ public static void PrintCSharp(this Expression expr, ref string result, bool str
161157
}
162158
var sb = new StringBuilder(1024);
163159
sb.Append("var @cs = ");
164-
sb = expr.ToCSharpString(sb, ToCSharpPrinter.EnclosedIn.AvoidParens, stripNamespace: stripNamespace).AppendSemicolonOnce();
160+
sb = expr.ToCSharpString(sb, ToCSharpPrinter.EnclosedIn.AvoidParens, stripNamespace: stripNamespace);
161+
sb.AppendSemicolonOnce();
165162
result = sb.ToString();
166163
Console.WriteLine(result);
167164
}

test/FastExpressionCompiler.TestsRunner/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static void Main()
2121
// new Issue455_TypeAs_should_return_null().Run();
2222
// new BlockTests().Run();
2323
// new LightExpression.IssueTests.Issue237_Trying_to_implement_For_Foreach_loop_but_getting_an_InvalidProgramException_thrown().Run();
24-
new AssignTests().Run();
24+
// new AssignTests().Run();
2525
// new LightExpression.IssueTests.Issue365_Working_with_ref_return_values().Run();
2626
// new ArithmeticOperationsTests().Run();
2727
// new Issue156_InvokeAction().Run();
@@ -44,14 +44,14 @@ public static void Main()
4444

4545
var st = new TestRun(TestFlags.RethrowException);
4646

47-
st.Run(new Issue495_Incomplete_pattern_detection_for_NotSupported_1007_Return_goto_from_TryCatch_with_Assign_generates_invalid_IL());
48-
st.Run(new Issue480_CLR_detected_an_invalid_program_exception());
49-
5047
#if NET8_0_OR_GREATER
5148
st.Run(new Issue487_Fix_ToCSharpString_output_for_boolean_equality_expressions());
5249
st.Run(new Issue475_Reuse_DynamicMethod_if_possible());
5350
#endif
5451

52+
st.Run(new Issue495_Incomplete_pattern_detection_for_NotSupported_1007_Return_goto_from_TryCatch_with_Assign_generates_invalid_IL());
53+
st.Run(new Issue480_CLR_detected_an_invalid_program_exception());
54+
5555
var lt = new LightExpression.TestRun(LightExpression.TestFlags.RethrowException);
5656

5757
#if NET8_0_OR_GREATER

0 commit comments

Comments
 (0)