Пример #1
0
        private void EnsureTracingTarget()
        {
            if (_tracingTarget == null)
            {
                PythonContext pc = (PythonContext)Ast.CompilerContext.SourceUnit.LanguageContext;

                var debugProperties = new PythonDebuggingPayload(null);

                var debugInfo = new Microsoft.Scripting.Debugging.CompilerServices.DebugLambdaInfo(
                    null,           // IDebugCompilerSupport
                    null,           // lambda alias
                    false,          // optimize for leaf frames
                    null,           // hidden variables
                    null,           // variable aliases
                    debugProperties // custom payload
                    );

                var lambda = (Expression <LookupCompilationDelegate>)pc.DebugContext.TransformLambda((MSAst.LambdaExpression)Ast.GetLambda().Reduce(), debugInfo);

                LookupCompilationDelegate func;
                if (ShouldInterpret(pc))
                {
                    func = (LookupCompilationDelegate)CompilerHelpers.LightCompile(lambda, pc.Options.CompilationThreshold);
                }
                else
                {
                    func = (LookupCompilationDelegate)lambda.Compile(pc.EmitDebugSymbols(Ast.CompilerContext.SourceUnit));
                }

                _tracingTarget       = func;
                debugProperties.Code = EnsureFunctionCode(_tracingTarget, true, true);
            }
        }
Пример #2
0
 internal TraceBackFrame(PythonTracebackListener traceAdapter, FunctionCode code, TraceBackFrame back, PythonDebuggingPayload debugProperties, Func <IDictionary <object, object> > scopeCallback)
 {
     _traceAdapter    = traceAdapter;
     _code            = code;
     _back            = back;
     _debugProperties = debugProperties;
     _scopeCallback   = scopeCallback;
 }
Пример #3
0
        private void EnsureTracingTarget()
        {
            if (_tracingTarget == null)
            {
                PythonContext pc = (PythonContext)Ast.CompilerContext.SourceUnit.LanguageContext;

                var debugProperties = new PythonDebuggingPayload(null);

                var debugInfo = new Microsoft.Scripting.Debugging.CompilerServices.DebugLambdaInfo(
                    null,           // IDebugCompilerSupport
                    null,           // lambda alias
                    false,          // optimize for leaf frames
                    null,           // hidden variables
                    null,           // variable aliases
                    debugProperties // custom payload
                    );

                var lambda = pc.DebugContext.TransformLambda(Ast.GetLambda(), debugInfo);
                _tracingTarget       = CompileBody((Expression <Func <CodeContext /*!*/, FunctionCode /*!*/, object> >)lambda);
                debugProperties.Code = EnsureFunctionCode(_tracingTarget);
            }
        }
Пример #4
0
 internal TraceBackFrame(PythonTracebackListener traceAdapter, FunctionCode code, TraceBackFrame back, PythonDebuggingPayload debugProperties, Func<IDictionary<object, object>> scopeCallback)
 {
     _traceAdapter = traceAdapter;
     _code = code;
     _back = back;
     _debugProperties = debugProperties;
     _scopeCallback = scopeCallback;
 }