124 references to ParseCompilationUnit
Microsoft.CodeAnalysis.CSharp (1)
Syntax\CSharpSyntaxTree.Dummy.cs (1)
25_node = this.CloneNodeAsRoot(SyntaxFactory.ParseCompilationUnit(string.Empty));
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
183UsingDirectiveSyntax => SyntaxFactory.ParseCompilationUnit(textToParse, options: (CSharpParseOptions)tree.Options),
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (3)
ExtractMethod\MiscTests.cs (2)
43var root = SyntaxFactory.ParseCompilationUnit(code); 88var root = SyntaxFactory.ParseCompilationUnit(code);
Formatting\CSharpFormattingEngineTestBase.cs (1)
23=> SyntaxFactory.ParseCompilationUnit(expected);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
PDB\PDBTests.cs (2)
132var tree1 = SyntaxFactory.ParseCompilationUnit(@" 136var tree2 = SyntaxFactory.ParseCompilationUnit(@"
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (3)
Attributes\AttributeTests_Conditional.cs (2)
250CompilationUnitSyntax root = SyntaxFactory.ParseCompilationUnit(testSource); 461CompilationUnitSyntax root = SyntaxFactory.ParseCompilationUnit(testSource);
Semantics\OutVarTests.cs (1)
32505var node0 = SyntaxFactory.ParseCompilationUnit(source);
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (1)
457var root = SyntaxFactory.ParseCompilationUnit(source, options: experimental);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (11)
Semantics\LocalFunctionTests.cs (8)
7360=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 7455=> SyntaxFactory.ParseCompilationUnit($@"{source};", options: parseOptions).DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7458=> SyntaxFactory.ParseCompilationUnit($@"{source};", options: parseOptions).DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 7532=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 7585=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 8941=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 9445=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 9763=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single();
Semantics\ScriptSemanticsTests.cs (3)
1179var compilationUnit = CSharp.SyntaxFactory.ParseCompilationUnit(code, options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1267var compilationUnit = CSharp.SyntaxFactory.ParseCompilationUnit("\nSystem.Console.WriteLine(1);", options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script)); 1306var compilationUnit = CSharp.SyntaxFactory.ParseCompilationUnit(code, options: new CSharp.CSharpParseOptions(kind: SourceCodeKind.Script));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (8)
Compilation\SemanticModelAPITests.cs (1)
3557return SyntaxFactory.ParseCompilationUnit(source + " class X {}").Members.First().AsTypeDeclarationSyntax().AttributeLists.First().Attributes.First();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (2)
4106return SyntaxFactory.ParseCompilationUnit(source + " class X {}").Members.First().AsTypeDeclarationSyntax().AttributeLists.First().Attributes.First(); 4369var attr8 = SyntaxFactory.ParseCompilationUnit(@"[assembly: O(""hello"")]").AttributeLists.First().Attributes.First();
Symbols\SymbolErrorTests.cs (5)
4323var tree1 = SyntaxFactory.ParseCompilationUnit(text1); 4328var tree2 = SyntaxFactory.ParseCompilationUnit(text2); 15809var tree1 = SyntaxFactory.ParseCompilationUnit(text1); 15825var tree2 = SyntaxFactory.ParseCompilationUnit(text2); 15844var tree3 = SyntaxFactory.ParseCompilationUnit(text3);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (49)
IncrementalParsing\GrammarAmbiguities.cs (1)
104var parsedRoot = SyntaxFactory.ParseCompilationUnit(syntaxTree.GetText().ToString());
Parsing\MemberDeclarationParsingTests.cs (1)
103var cu = SyntaxFactory.ParseCompilationUnit(sb.ToString());
Parsing\ParsingErrorRecoveryTests.cs (1)
22return SyntaxFactory.ParseCompilationUnit(text, options: options);
Parsing\ParsingTests.cs (1)
81SyntaxFactory.ParseCompilationUnit(text, options: parseOptions);
Parsing\RawInterpolatedStringLiteralCompilingTests.cs (1)
63SyntaxFactory.ParseCompilationUnit(text[0..^i]);
Syntax\SyntaxNodeTests.cs (33)
64var cls = SyntaxFactory.ParseCompilationUnit("class C { }").Members[0] as ClassDeclarationSyntax; 306var cu = SyntaxFactory.ParseCompilationUnit(text); 351Assert.False(SyntaxFactory.ParseCompilationUnit("").ContainsDirective(kind)); 355Assert.False(SyntaxFactory.ParseCompilationUnit("namespace N { }").ContainsDirective(kind)); 360var compilationUnit = SyntaxFactory.ParseCompilationUnit("namespace N { } #if false"); 387testContainsHelper2(new[] { SyntaxKind.ShebangDirectiveTrivia }, SyntaxFactory.ParseCompilationUnit("#!command", options: TestOptions.Script)); 388testContainsHelper2(new[] { SyntaxKind.BadDirectiveTrivia }, SyntaxFactory.ParseCompilationUnit(" #!command", options: TestOptions.Script)); 389testContainsHelper2(new[] { SyntaxKind.BadDirectiveTrivia }, SyntaxFactory.ParseCompilationUnit("#!command", options: TestOptions.Regular)); 398testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit(directive)); 401testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 407testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 413testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 421testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 430testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 439testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 454testContainsHelper2(directiveKinds, SyntaxFactory.ParseCompilationUnit($$""" 486var compilationUnit = SyntaxFactory.ParseCompilationUnit(""" 2272var cu = SyntaxFactory.ParseCompilationUnit("private class C { }"); 2290var cu = SyntaxFactory.ParseCompilationUnit("private class C { }"); 2306var cu = SyntaxFactory.ParseCompilationUnit("public class C { }"); 2321var cu = SyntaxFactory.ParseCompilationUnit("public class C { }"); 2367var cu = SyntaxFactory.ParseCompilationUnit(text); 2723var cu = SyntaxFactory.ParseCompilationUnit("class C { void M() { } /* trivia */ }"); 2739var cu = SyntaxFactory.ParseCompilationUnit(@" 2881var cu = SyntaxFactory.ParseCompilationUnit(@"class A { } class B { } // test"); 2897var cu = SyntaxFactory.ParseCompilationUnit(@"class A { } class B { } #endregion"); 2913var cu = SyntaxFactory.ParseCompilationUnit(@" 3058var cu = SyntaxFactory.ParseCompilationUnit(@" 3225var cu = SyntaxFactory.ParseCompilationUnit(@" 3493var node = SyntaxFactory.ParseCompilationUnit(" "); 3515var root = SyntaxFactory.ParseCompilationUnit(text); 3547var root = SyntaxFactory.ParseCompilationUnit(text); 3992action(SyntaxFactory.ParseCompilationUnit(test.Key), test.Value);
Syntax\SyntaxNormalizerTests.cs (3)
3408var node = SyntaxFactory.ParseCompilationUnit(text.NormalizeLineEndings()); 3798var actual = SyntaxFactory.ParseCompilationUnit(code).NormalizeWhitespace(indentation: " ", eol: "\n").ToFullString(); 3814var actual = SyntaxFactory.ParseCompilationUnit(code).NormalizeWhitespace(indentation: " ").ToFullString();
Syntax\SyntaxRewriterTests.cs (2)
323var node1 = SyntaxFactory.ParseCompilationUnit("class Class1<T> { }"); 670var root = SyntaxFactory.ParseCompilationUnit(text);
Syntax\SyntaxTreeTests.cs (6)
81var root = SyntaxFactory.ParseCompilationUnit(source, options: parseOptions); 119var root = SyntaxFactory.ParseCompilationUnit(""); 131var tree = CSharpSyntaxTree.Create(SyntaxFactory.ParseCompilationUnit(""), options: null, path: null, encoding: null, diagnosticOptions: options); 244var newRoot = SyntaxFactory.ParseCompilationUnit("class C {}"); 262var newRoot = SyntaxFactory.ParseCompilationUnit("class C {}"); 277var newRoot = SyntaxFactory.ParseCompilationUnit("class C {}");
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (25)
CodeGeneration\SyntaxGeneratorTests.cs (21)
1519var cu = ParseCompilationUnit(code); 1983var cls = ParseCompilationUnit(@"// comment 2660var cu = ParseCompilationUnit(code); 2684var cu = ParseCompilationUnit(code); 2709var cu = ParseCompilationUnit(code); 2732var cu = ParseCompilationUnit(code); 3443var root = ParseCompilationUnit( 3464var root = ParseCompilationUnit( 3486var root = ParseCompilationUnit( 3512var root = ParseCompilationUnit( 3637var classBI = ParseCompilationUnit( 3648var classB = ParseCompilationUnit( 3658var classN = ParseCompilationUnit( 3671var classBI = ParseCompilationUnit( 3701var classC = ParseCompilationUnit( 3706var classCI = ParseCompilationUnit( 3711var classCB = ParseCompilationUnit( 3739var classC = ParseCompilationUnit( 3744var classCI = ParseCompilationUnit( 3749var classCB = ParseCompilationUnit( 4580var root = ParseCompilationUnit(text);
Formatting\CSharpFormattingTestBase.cs (1)
23=> SyntaxFactory.ParseCompilationUnit(text, options: (CSharpParseOptions)parseOptions);
Formatting\FormattingElasticTriviaTests.cs (1)
110var root = ParseCompilationUnit(text);
Formatting\FormattingTriviaTests.cs (2)
1742var tree = SyntaxFactory.ParseCompilationUnit("class C\r\n{\r\n}"); 1783var tree = SyntaxFactory.ParseCompilationUnit(code);
Microsoft.CodeAnalysis.Features.UnitTests (1)
EditAndContinue\RudeEditDiagnosticTests.cs (1)
22var tree = SyntaxFactory.ParseCompilationUnit("class C { }").SyntaxTree;
Microsoft.CodeAnalysis.Test.Utilities (1)
Syntax\TokenUtilities.cs (1)
100return CS.SyntaxFactory.ParseCompilationUnit(expectedText, options: (CS.CSharpParseOptions)options);
Microsoft.CodeAnalysis.Workspaces.UnitTests (12)
Editing\SyntaxEditorTests.cs (9)
47var cu = SyntaxFactory.ParseCompilationUnit(code); 73var cu = SyntaxFactory.ParseCompilationUnit(code); 98var cu = SyntaxFactory.ParseCompilationUnit(code); 125var cu = SyntaxFactory.ParseCompilationUnit(code); 152var cu = SyntaxFactory.ParseCompilationUnit(code); 173var cu = SyntaxFactory.ParseCompilationUnit(code); 219var cu = SyntaxFactory.ParseCompilationUnit(code); 263var cu = SyntaxFactory.ParseCompilationUnit(code); 308var cu = SyntaxFactory.ParseCompilationUnit(code);
SolutionTests\SolutionTests.cs (3)
2454var root = CSharp.SyntaxFactory.ParseCompilationUnit("class C {}"); 2512var root = CSharp.SyntaxFactory.ParseCompilationUnit("class C {}"); 3792var newRoot = (language == LanguageNames.CSharp) ? CS.SyntaxFactory.ParseCompilationUnit("""
Microsoft.Gen.ContextualOptions.Unit.Tests (5)
EmitterTests.cs (5)
27.ParseCompilationUnit(File.ReadAllText("TestClasses/Struct1.cs")) 46.ParseCompilationUnit(File.ReadAllText("TestClasses/Class2A.cs")) 50.ParseCompilationUnit(File.ReadAllText("TestClasses/Class2B.cs")) 78.ParseCompilationUnit(File.ReadAllText("TestClasses/Record1.cs")) 106.ParseCompilationUnit(File.ReadAllText("TestClasses/NamespacelessRecord.cs"))
Microsoft.VisualStudio.LanguageServices.CSharp (1)
Snippets\CSharpSnippetExpansionLanguageHelper.cs (1)
136var candidateUsing = SyntaxFactory.ParseCompilationUnit("using " + namespaceToImport + ";").DescendantNodes().OfType<UsingDirectiveSyntax>().FirstOrDefault();