Ejemplo n.º 1
0
        internal DebuggableLambdaBuilder(DebugContext debugContext, DebugLambdaInfo lambdaInfo)
        {
            _debugContext = debugContext;
            _lambdaInfo   = lambdaInfo;

            _alias = _lambdaInfo.LambdaAlias;
            _debugContextExpression = AstUtils.Constant(debugContext);

            // Variables
            _verifiedLocals             = new List <MSAst.ParameterExpression>();
            _verifiedLocalNames         = new Dictionary <string, object>();
            _pendingLocals              = new List <MSAst.ParameterExpression>();
            _variableInfos              = new List <VariableInfo>();
            _pendingToVariableInfosMap  = new Dictionary <MSAst.ParameterExpression, VariableInfo>();
            _pendingToVerifiedLocalsMap = new Dictionary <MSAst.ParameterExpression, MSAst.ParameterExpression>();

            // DebugMode expression that's used by the transformed code to see what the current debug mode is
            _globalDebugMode = Ast.Property(_debugContextExpression, "Mode");
        }
        internal DebugInfoRewriter(
            DebugContext debugContext,
            bool transformToGenerator,
            Expression traceLocations,
            Expression thread,
            Expression frame,
            Expression pushFrame,
            Expression debugMarker,
            Expression globalDebugMode,
            Dictionary <DebugSourceFile, ParameterExpression> sourceFilesToVariablesMap,
            LabelTarget generatorLabel,
            Dictionary <ParameterExpression, ParameterExpression> replacedLocals,
            Dictionary <ParameterExpression, VariableInfo> localsToVarInfos,
            DebugLambdaInfo lambdaInfo)
        {
            _debugContext         = debugContext;
            _transformToGenerator = transformToGenerator;
            _traceLocations       = traceLocations;
            _thread    = thread;
            _frame     = frame;
            _pushFrame = pushFrame;

            if (_transformToGenerator)
            {
                _debugYieldValue = Ast.Constant(DebugContext.DebugYieldValue);

                // When transforming to generator we'll also create marker-location and position-handler maps
                _markerLocationMap     = new Dictionary <int, DebugSourceSpan>();
                _variableScopeMap      = new Dictionary <int, IList <VariableInfo> >();
                _currentLocals         = new Stack <BlockExpression>();
                _variableScopeMapCache = new Dictionary <BlockExpression, IList <VariableInfo> >();
            }

            _debugMarker               = debugMarker;
            _globalDebugMode           = globalDebugMode;
            _sourceFilesToVariablesMap = sourceFilesToVariablesMap;
            _generatorLabelTarget      = generatorLabel;
            _replacedLocals            = replacedLocals;
            _localsToVarInfos          = localsToVarInfos;
            _lambdaInfo = lambdaInfo;
        }
Ejemplo n.º 3
0
 public TransformAllLambda(DebugContext context)
 {
     this.context         = context;
     this.debugLambdaInfo = new DebugLambdaInfo(this, null, false, null, null, null);
 }             // ctor