icsharpcode/NRefactory — pull request #82 by erik-kallen (2012-07-22 19:17:26+00:00)
Title: Attempt to pass more detailed information about query expressions to the outside world

NRefactory can currently resolve query experssions, in the sense that it can determine that ```from a in arr select a + 1``` is a call to ```Enumerable.Select```, but it does not report other interesting semantics, such as
```from a in arr let b = a + 1 select a + b``` is transformed to something like ```arr.Select(a => new { a, b = a + 1 }).Select(x => x.a + x.b)```

This commit is a POC of how an API for this could look. It contains the following changes:

1) The QueryExpressionLambda class has been made public. It has a property called ```RangeVariableMap``´ that can be used to determine how to access local variables inside the lambda body.
2) The parameter types are correct in ```QueryExpressionLambda```s.
3) The body for a lambda representing a let clause is something like ```x => new { x, newValue = expr }``` (it used to be meaningless).

This is by no means complete work, it's just intended as a starting point for a discussion of how the feature could look. It is also not implemented for the entire pattern, but as a test expression, it works for

```
public void Main(string[] args)
{
var v = from a in args let i = int.Parse(a) let j = i + 1 where i > j select i + j;
}
```

(and I also modified the demo program to show the relevant info).

What do you think?

(Btw, thanks for giving me credit as an author yesterday, it's a great honor).