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); }
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)); }