You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DataFlowsOut expects to intercept all assignments by overriding the AssignImpl method in definite assignment. This method requires the bound node of the value, being assigned and the bound node of the variable being assigned. That information is not available for local function calls and is not possible to store.
To make this API work for local function calls we need a new interception point that only requires the slot being assigned, since that is all that is stored for local functions and should be sufficient to provide the basic information for DataFlowsOut.
see the following test:
[Fact][WorkItem(39569,"https://github.com/dotnet/roslyn/issues/39569")]publicvoidAssignmentInsideLocal05(){vardataFlowAnalysisResults= CompileAndAnalyzeDataFlowStatements(@"class Program{ static void Main() { int x = 3, y = 4; void Local() { x = 1; }/*<bind>*/ Local();/*</bind>*/ System.Console.WriteLine(x); }}");// Right now region analysis requires bound nodes for each variable and value being// assigned. This doesn't work with the current local function analysis because we only// store the slots, not the full boundnode of every assignment (which is impossible// anyway)
Assert.Equal("x", GetSymbolNamesJoined(dataFlowAnalysisResults.DataFlowsOut));
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.VariablesDeclared));
Assert.Equal("x", GetSymbolNamesJoined(dataFlowAnalysisResults.AlwaysAssigned));
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.DataFlowsIn));
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.ReadInside));
Assert.Equal("x", GetSymbolNamesJoined(dataFlowAnalysisResults.ReadOutside));
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.WrittenInside));
Assert.Equal("x, y", GetSymbolNamesJoined(dataFlowAnalysisResults.WrittenOutside));
Assert.Equal("x", GetSymbolNamesJoined(dataFlowAnalysisResults.Captured));}
The text was updated successfully, but these errors were encountered:
DataFlowsOut expects to intercept all assignments by overriding the AssignImpl method in definite assignment. This method requires the bound node of the value, being assigned and the bound node of the variable being assigned. That information is not available for local function calls and is not possible to store.
To make this API work for local function calls we need a new interception point that only requires the slot being assigned, since that is all that is stored for local functions and should be sufficient to provide the basic information for DataFlowsOut.
see the following test:
The text was updated successfully, but these errors were encountered: