• T
    Preparation for hoisting more locals in Debug builds. I noticed we can use... · ad2bd29c
    TomasMatousek 提交于
    Preparation for hoisting more locals in Debug builds. I noticed we can use less maps while rewriting a method to a class.
    
         MethodToClassRewriter:
         - parameterMap could be moved up to LambdaRewriter since it's only needed when rewriting lambdas.
         - variablesCaptured is replaced by a virtual NeedsProxy method which is implemented on LambdaRewriter and StateMachineRewriter using existing maps (so we can save another HashSet).
            We can also distinguish between "captured" variables and variables we create proxy field for. The former are deduced from syntax. A variable may be captured but not lifted into a field (e.g. expression tree lambda parameter). Or a variable can be lifted to field but not captured (in Debug builds we are going to lift user defined variables that are not captured to allow their later capture during EnC).
    
         LambdaRewriter:
         - variablesCaptured encodes the same information as keys of captured syntax multi-dictionary.
         - declaredInsideExpressionLambda is not needed either. When visiting ET lambdas we used to add their parameters to both variableBlock and declaredInsideExpressionLambda maps. Since ET lambda parameters are never lifted to closure we can avoid adding them to variableBlock map instead of excluding them later via declaredInsideExpressionLambda lookup.
    
         Adds internal IReadOnlySet similar to IReadOnlyList and IReadOnlyDictionary so that we can specify an intent of not mutating a set. (changeset 1317999)
    ad2bd29c
MethodToClassRewriter.cs 28.1 KB