public override void VisitCFGForeachMoveNextEdge(ForeachMoveNextEdge x) { var state = _state; // get type information from Enumeree to determine types value variable var elementType = HandleTraversableUse(x.EnumereeEdge.Enumeree); if (elementType.IsVoid) { elementType = TypeRefMask.AnyType; } // Body branch _state = state.Clone(); // set key variable and value variable at current state var valueVar = x.ValueVariable; var islistunpacking = valueVar is BoundListEx; // analyse Value Visit(valueVar, valueVar.Access.WithWrite(valueVar.Access.IsWriteRef ? elementType.WithRefFlag : elementType)); // analyse Key var keyVar = x.KeyVariable; if (keyVar != null) { Visit(keyVar, keyVar.Access.WithWrite(TypeRefMask.AnyType)); } TraverseToBlock(x, _state, x.BodyBlock); // End branch _state = state.Clone(); TraverseToBlock(x, _state, x.NextBlock); }
public override void VisitCFGForeachMoveNextEdge(ForeachMoveNextEdge x) { var state = _state; // get type information from Enumeree to determine types value variable var elementType = HandleTraversableUse(x.EnumereeEdge.Enumeree); if (elementType.IsVoid) { elementType = TypeRefMask.AnyType; } // Body branch _state = state.Clone(); // set key variable and value variable at current state var valueVar = x.ValueVariable; if (valueVar is BoundListEx) { throw new NotImplementedException(); //VisitListEx(valueVar.List, elementType); } else { valueVar.Access = valueVar.Access.WithWrite(valueVar.Access.IsWriteRef ? elementType.WithRefFlag : elementType); Accept(valueVar); // var keyVar = x.KeyVariable; if (keyVar != null) { keyVar.Access = keyVar.Access.WithWrite(TypeRefMask.AnyType); Accept(keyVar); } } TraverseToBlock(x, _state, x.BodyBlock); // End branch _state = state.Clone(); TraverseToBlock(x, _state, x.NextBlock); }