Пример #1
0
            public SyntaxTree AddSource(GeneratedSourceText sourceText)
            {
                var compilation = DeclaringCompilation as CSharpCompilation ?? throw new NotSupportedException("Non C# compilation is not supported");
                var syntax      = CSharpSyntaxTree.ParseText(sourceText.SourceText, new CSharpParseOptions(compilation.LanguageVersion), cancellationToken: Parent._context.OnOperationCanceled);

                DeclaringCompilation = DeclaringCompilation.AddSyntaxTrees(syntax);
                GeneratedSourceTexts.Add(sourceText);
                return(syntax);
            }