private async Task<Document> InitializeWithLocals(Document document, InitializerExpressionSyntax objectInitializer, CancellationToken cancellationToken)
 {
     var semanticModel = await document.GetSemanticModelAsync(cancellationToken);
     var syntaxGenerator= SyntaxGenerator.GetGenerator(document);
     var sourceFinders = GetAllPossibleSourceFinders(objectInitializer, semanticModel, syntaxGenerator).ToList();
     var mappingMatcher = new BestPossibleMatcher(sourceFinders);
     return await ReplaceEmptyInitializationBlock(document, objectInitializer, semanticModel, mappingMatcher, cancellationToken);
 }
Ejemplo n.º 2
0
        private async Task <Document> InitializeWithLocals(Document document, LambdaExpressionSyntax lambdaExpressionSyntax, CancellationToken cancellationToken)
        {
            var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);

            var sourceFinders  = GetAllPossibleSourceFinders(lambdaExpressionSyntax, semanticModel).ToList();
            var mappingMatcher = new BestPossibleMatcher(sourceFinders);

            return(await ReplaceWithMappingBody(document, lambdaExpressionSyntax, semanticModel, mappingMatcher, cancellationToken).ConfigureAwait(false));
        }