Quantcast
Channel: roslyn Source Code Rss Feed
Viewing all articles
Browse latest Browse all 70

Source code checked in, #1c2452f7dff61a6a6890f05ed5a1b466b25b2585

$
0
0
DevDiv #1024137 - Part 1: "this" in C# iterators and async When the callstack tells us that we're in a state machine MoveNext method, we want to bind as though we're really in the iterator or async method that caused the state machine to be generated. Parameters and locals are handled by special binders, but "this" and "base" won't work unless the binder has an appropriate ContainingType, which in turn depends on ContainingMemberOrLambda. Unfortunately, the generated code (and the custom debug info) lacks sufficient information to map back to a single member. All we get is the name of the member in the mangled name of the state machine type. We apply a heuristic to choose an appropriate overload, if there are multiple, and accept that sometimes we will pick the wrong one. We believe that picking the wrong one will be benign since the binder uses relatively few properties of the ContainingMemberOrLambda and the ones it does (mainly, ContainingType) are consistent across all overloads. Bonus: merge ThisReferenceRewriter into CapturedVariableRewriter. This saves us a pass over the bound tree and eliminates an intermediate state in which "this" has the wrong type (ThisReferenceRewriter used to break it and let CapturedVariableRewriter correct it). TODO: Part 2 - "Me" in VB iterators and async. TODO: Part 3 - "this" in anonymous functions. CR: ChuckS, KevinH (changeset 1357667)

Viewing all articles
Browse latest Browse all 70

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>