예제 #1
0
        protected override Expression VisitMethodCall(MethodCallExpression node)
        {
            ISyntaxTransformer transformer = node.Method.GetCustomTransformer();

            if (transformer != null)
            {
                return(base.Visit(transformer.Transform(node)));
            }
            return(base.VisitMethodCall(node));
        }
예제 #2
0
        public async Task <IEnumerable <IValidationResult> > Validate(string solutionPath, IEnumerable <IModelRule> rules, IEnumerable <TransformRule> transformRules, CancellationToken cancellationToken)
        {
            var model = await _repository.GetVertices(solutionPath, cancellationToken).ConfigureAwait(false);

            var transformed = await _syntaxTransformer.Transform(model, transformRules, cancellationToken).ConfigureAwait(false);

            var modelTree = new ModelNode("All", NodeKind.Solution, CodeQuality.Good, 0, 0, 0, transformed.ToList());
            var tasks     = rules.Select(r => r.Validate(modelTree));
            var results   = await Task.WhenAll(tasks).ConfigureAwait(false);

            return(results.SelectMany(x => x).AsArray());
        }