I changed the code to use stacks... like this:

        private Stack<Dictionary<string, int>>
_memberExpressionMappings = new Stack<Dictionary<string, int>>();
        private Stack<HashSet<string>>
_collectedPathMemberExpressionsInExpressions = new
Stack<HashSet<string>>();

                _memberExpressionMappings.Push(new Dictionary<string, int>());
                var newLeft = VisitExpression(expression.Left);
                var leftMapping = _memberExpressionMappings.Pop();

This has uncovered a couple other problems that I have yet to fix.

       Patrick Earl

On Sun, Apr 17, 2011 at 11:41 AM, Harald Mueller
<[email protected]> wrote:
> Hi Patrick -
>
> I'll look into it! However, I'd also like to write an email to the Relinq 
> people about how to best write "tree node attributing" visitors.
>
> Visitors that I write usually have an additional parameter where "local" data 
> can be passed down and up; Relinq visitors do not have this, so I used these 
> global variables in the visitor - with the risk of forgetting them or 
> overwriting or taking the wrong value ... which seems to have happened ... 
> because I did not write enough test cases for complex (nested) expressions ...
>
> Regards
> Harald

Reply via email to