Exemplo n.º 1
0
        protected object InvokeTarget(LambdaExpression code, Scope scope) {
            if (scope == _optimizedScope) {
                return _optimizedTarget(scope, LanguageContext);
            } 

            // new scope, compile unoptimized code and use that.
            if (_unoptimizedTarget == null) {
                // TODO: fix generated DLR ASTs - languages should remove their usage
                // of GlobalVariables and then this can go away.
                Expression<DlrMainCallTarget> lambda = new GlobalLookupRewriter().RewriteLambda(code);

                _unoptimizedTarget = lambda.Compile(SourceUnit.EmitDebugSymbols);
            }


            return _unoptimizedTarget(scope, LanguageContext);            
        }