/**********************************************************************************/
        /// <summary>
        /// Parse expression and convert it to exspression against TTarget
        /// </summary>
        /// <param name="expression"></param>
        public void Parse(Expression <Func <TSource, bool> > expression)
        {
            _properties.Clear();
            TargetExpression         = null;
            CompiledTargetExpression = null;

            var p       = Expression.Parameter(typeof(TTarget), expression.Parameters[0].Name);
            var v       = new TransformationVisitor(p, _propertyNamesMapper, _properties);
            var newBody = v.Visit(expression.Body);

            TargetExpression         = Expression.Lambda <Func <TTarget, bool> >(newBody, p);
            CompiledTargetExpression = TargetExpression.Compile();
        }
Пример #2
0
        internal void TransformMethods()
        {
            // TODO: Iterate the transformation cycle
            var updatedRoutines = new ConcurrentBag <SourceRoutineSymbol>();

            this.WalkMethods(m =>
            {
                if (TransformationVisitor <VoidStruct> .TryTransform(m))
                {
                    updatedRoutines.Add(m);
                }
            },
                             allowParallel: true);

            // Run the analysis again on the changed methods
            if (updatedRoutines.Count > 0)
            {
                _worklist.Update(updatedRoutines, concurrent: ConcurrentBuild);
            }
        }