299 references to ParseExpression
Microsoft.AspNetCore.App.CodeFixes (1)
Kestrel\ListenOnIPv6AnyFixer.cs (1)
67.WithExpression(SyntaxFactory.ParseExpression($"{instanceVariableInvoked.ToString()}.ListenAnyIP"))
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Formatting\FormattingEngineTests.cs (1)
1736var node = SyntaxFactory.ParseExpression(code);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
CodeGen\CodeGenCheckedTests.cs (2)
2918var nodeToSpeculate = SyntaxFactory.ParseExpression("x + y"); 2950var nodeToSpeculate = SyntaxFactory.ParseExpression("x + y");
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (10)
Attributes\AttributeTests_RefReadOnly.cs (2)
1381var newInvocation = SyntaxFactory.ParseExpression("Process((in int x) => x)"); 1423var newInvocation = SyntaxFactory.ParseExpression("Process(() => ref x)");
Semantics\OutVarTests.cs (4)
34335SyntaxFactory.ParseExpression($"TakeOutParam(true, out var x{i + 1})"), 34337SyntaxFactory.ParseExpression($"x{i + 1}") 34549SyntaxFactory.ParseExpression($"TakeOutParam(true, out var x{i + 1})"), 34551SyntaxFactory.ParseExpression($"x{i + 1}")
Semantics\PatternMatchingTests.cs (4)
4173SyntaxFactory.ParseExpression("A is B < C, D > E").GetDiagnostics().Verify(); 4174SyntaxFactory.ParseExpression("A as B < C, D > E").GetDiagnostics().Verify( 4180SyntaxFactory.ParseExpression("A as B < C, D > ?? string.Empty").GetDiagnostics().Verify(); 4181SyntaxFactory.ParseExpression("A is B < C, D > ?? string.Empty").GetDiagnostics().Verify(
Microsoft.CodeAnalysis.CSharp.Features (5)
ChangeSignature\CSharpChangeSignatureService.cs (1)
648? EqualsValueClause(ParseExpression(addedParameter.DefaultValue))
ConvertToInterpolatedString\CSharpConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
31=> SyntaxFactory.ParseExpression(text);
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (1)
247var parsed = (InterpolatedStringExpressionSyntax)ParseExpression(indentedText.ToString(), options: stringExpression.SyntaxTree.Options);
Debugging\CSharpProximityExpressionsService.cs (1)
55var expression = SyntaxFactory.ParseExpression(expressionValue);
ReplaceDocCommentTextWithTag\CSharpReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (1)
33=> SyntaxFactory.ParseExpression(text);
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (3)
IOperation\IOperationTests_IVariableDeclaration.cs (3)
2303.WithSizes(SyntaxFactory.SeparatedList<ExpressionSyntax>(SyntaxFactory.NodeOrTokenList(SyntaxFactory.ParseExpression("y switch { int z => 42 }")))); 2364.WithSizes(SyntaxFactory.SeparatedList<ExpressionSyntax>(SyntaxFactory.NodeOrTokenList(SyntaxFactory.ParseExpression("y switch { int z => 42 }")))); 2832.WithSizes(SyntaxFactory.SeparatedList<ExpressionSyntax>(SyntaxFactory.NodeOrTokenList(SyntaxFactory.ParseExpression("y switch { int z => 42 }"))));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (7)
Semantics\ImplicitObjectCreationTests.cs (1)
4160var newExpression = SyntaxFactory.ParseExpression("new()");
Semantics\LambdaTests.cs (1)
946SyntaxFactory.ParseExpression("Goo(() => () => { var x = null; return x; })"), // cast removed
Semantics\QueryTests.cs (1)
2300var info = semanticModel.GetSpeculativeTypeInfo(selectExpression.SpanStart, SyntaxFactory.ParseExpression("x"), SpeculativeBindingOption.BindAsExpression);
Semantics\SuppressAccessibilityChecksTests.cs (3)
75var exp = SyntaxFactory.ParseExpression("new A().M()._num"); 126SyntaxFactory.ParseExpression("a._p"), 174var speculativeInvocation = SyntaxFactory.ParseExpression("new A().InternalExtension(67)");
Semantics\TargetTypedDefaultTests.cs (1)
2484var expressionSyntax = SyntaxFactory.ParseExpression("default");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (40)
Compilation\CompilationAPITests.cs (1)
787SyntaxTree withExpressionRootTree = SyntaxFactory.ParseExpression(s3).SyntaxTree;
Compilation\GetSemanticInfoTests.cs (8)
3786var syntax = SyntaxFactory.ParseExpression(" C.M"); //Leading trivia was significant for triggering an assert before the fix. 3819var syntax = SyntaxFactory.ParseExpression(" C.M"); //Leading trivia was significant for triggering an assert before the fix. 3913var syntax = SyntaxFactory.ParseExpression(" a.P"); //Leading trivia was significant for triggering an assert before the fix. 3953var syntax = SyntaxFactory.ParseExpression(" a.P"); //Leading trivia was significant for triggering an assert before the fix. 4066var speculativeSyntax = SyntaxFactory.ParseExpression("fields.Any((field => field.IsStatic))"); //cast removed 4322var speculativeSyntax = SyntaxFactory.ParseExpression("new List { 1, 2 }"); 4876var newSyntax = SyntaxFactory.ParseExpression("Instance.GetList().OfType<D>().Any()"); 6012var syntax = SyntaxFactory.ParseExpression("base");
Compilation\SemanticModelAPITests.cs (14)
1420var equalsValue = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression(@"(string)""Hello""")); 1462var newEqualsValue = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression("(short)0")); 1510var newEqualsValue = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression("(short)0")); 1557var newEqualsValue = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression("E.B | E.A")); 1598var newEqualsValue = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression("(short)0")); 1679var newExpressionBody = SyntaxFactory.ArrowExpressionClause(SyntaxFactory.ParseExpression(@"(string)""Hello""")); 2030SyntaxFactory.ParseExpression("this.y")); 2091var newArgument = SyntaxFactory.ParseExpression("1"); 2108newArgument = SyntaxFactory.ParseExpression("(string) 1"); 2191var speculatedStatement = statement.ReplaceNode(initializer.Value, SyntaxFactory.ParseExpression("0")); 2225var speculatedStatement = statement.ReplaceNode(expression, SyntaxFactory.ParseExpression("0")); 2233var newSpeculatedStatement = statement.ReplaceNode(expression, SyntaxFactory.ParseExpression("1.1")); 3346var statementSyntax = SyntaxFactory.ParseExpression("TakesOut(out int x)"); 3504var statementSyntax = SyntaxFactory.ParseExpression("Method(o is string s)");
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (1)
4089var expression = SyntaxFactory.ParseExpression("B");
Symbols\AnonymousTypesSymbolTests.cs (1)
1478var expr1 = SyntaxFactory.ParseExpression("new { x = 1, y" + i.ToString() + " = \"---\" }");
Symbols\CheckedUserDefinedOperatorsTests.cs (4)
7432var xNodeToSpeculate = SyntaxFactory.ParseExpression("-x"); 7433var yNodeToSpeculate = SyntaxFactory.ParseExpression("-y"); 7496var xNodeToSpeculate = SyntaxFactory.ParseExpression("-x"); 7497var yNodeToSpeculate = SyntaxFactory.ParseExpression("-y");
Symbols\ConversionTests.cs (1)
423ExpressionSyntax sourceExpression5 = SyntaxFactory.ParseExpression("100L");
Symbols\Source\NullablePublicAPITests.cs (10)
1372var newReference = (IdentifierNameSyntax)SyntaxFactory.ParseExpression(@"s1"); 1373var newCoalesce = (AssignmentExpressionSyntax)SyntaxFactory.ParseExpression(@"s3 ??= s1", options: TestOptions.Regular8); 1517var newReference = (IdentifierNameSyntax)SyntaxFactory.ParseExpression(@"s1"); 1518var newCoalesce = (AssignmentExpressionSyntax)SyntaxFactory.ParseExpression(@"s1 ??= """""); 1573var newReference = (IdentifierNameSyntax)SyntaxFactory.ParseExpression(@"Prop"); 1574var newCoalesce = (AssignmentExpressionSyntax)SyntaxFactory.ParseExpression(@"Prop ??= """""); 4069var speculativeInitializer = SyntaxFactory.EqualsValueClause(SyntaxFactory.ParseExpression("o1")); 4578var arrow = SyntaxFactory.ArrowExpressionClause(SyntaxFactory.ParseExpression(" M(out C c)")); 4606var arrow = SyntaxFactory.ArrowExpressionClause(SyntaxFactory.ParseExpression(@" 4701var expression = SyntaxFactory.ParseExpression(@"M(out C c)");
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (203)
Parsing\AsyncParsingTests.cs (1)
26return SyntaxFactory.ParseExpression(text, options: (options ?? TestOptions.Regular).WithLanguageVersion(LanguageVersion.CSharp5));
Parsing\AsyncStreamsParsingTests.cs (1)
27return SyntaxFactory.ParseExpression(text, options: (options ?? TestOptions.Regular).WithLanguageVersion(LanguageVersion.CSharp8));
Parsing\AwaitParsingTests.cs (1)
24return SyntaxFactory.ParseExpression(text);
Parsing\ExpressionParsingTests.cs (2)
27return SyntaxFactory.ParseExpression(text, options: options); 2988var expr = SyntaxFactory.ParseExpression(text);
Parsing\LambdaAttributeParsingTests.cs (1)
29return SyntaxFactory.ParseExpression(text, options: options);
Parsing\LambdaParameterParsingTests.cs (1)
27return SyntaxFactory.ParseExpression(text, options: options);
Parsing\LambdaReturnTypeParsingTests.cs (1)
23return SyntaxFactory.ParseExpression(text, options: options);
Parsing\LineSpanDirectiveParsingTests.cs (1)
25return SyntaxFactory.ParseExpression(text, options: options);
Parsing\ParserErrorMessageTests.cs (1)
6579var expr = SyntaxFactory.ParseExpression(builder.ToString());
Parsing\ParserRegressionTests.cs (1)
178SyntaxFactory.ParseExpression(code);
Parsing\ParsingTests.cs (1)
123UsingNode(text, SyntaxFactory.ParseExpression(text, options: options), expectedErrors);
Parsing\PatternParsingTests.cs (16)
229UsingNode(SyntaxFactory.ParseExpression("A is B < C, D > [ ]")); 274UsingNode(SyntaxFactory.ParseExpression("A < B > C")); 302SyntaxFactory.ParseExpression("e is A<B> && e").GetDiagnostics().Verify(); 303SyntaxFactory.ParseExpression("e is A<B> || e").GetDiagnostics().Verify(); 304SyntaxFactory.ParseExpression("e is A<B> ^ e").GetDiagnostics().Verify(); 305SyntaxFactory.ParseExpression("e is A<B> | e").GetDiagnostics().Verify(); 306SyntaxFactory.ParseExpression("e is A<B> & e").GetDiagnostics().Verify(); 307SyntaxFactory.ParseExpression("e is A<B>[]").GetDiagnostics().Verify(); 308SyntaxFactory.ParseExpression("new { X = e is A<B> }").GetDiagnostics().Verify(); 309SyntaxFactory.ParseExpression("e is A<B>").GetDiagnostics().Verify(); 311SyntaxFactory.ParseExpression("(item is Dictionary<string, object>[])").GetDiagnostics().Verify(); 312SyntaxFactory.ParseExpression("A is B < C, D > [ ]").GetDiagnostics().Verify(); 313SyntaxFactory.ParseExpression("A is B < C, D > [ ] E").GetDiagnostics().Verify(); 314SyntaxFactory.ParseExpression("A < B > C").GetDiagnostics().Verify(); 320SyntaxFactory.ParseExpression("from s in a where s is string where s.Length > 1 select s").GetDiagnostics().Verify(); 321SyntaxFactory.ParseExpression("M(out int? x)").GetDiagnostics().Verify();
Parsing\RoundTrippingTests.cs (2)
1592var typeOfExpression = SyntaxFactory.ParseExpression(text, consumeFullText: true); 1596typeOfExpression = SyntaxFactory.ParseExpression(text, consumeFullText: false);
Parsing\SuppressNullableWarningExpressionParsingTests.cs (1)
23return SyntaxFactory.ParseExpression(text, options: options);
Syntax\GreenNodeTests.cs (3)
44var expression = SyntaxFactory.ParseExpression("x"); 56var expression = SyntaxFactory.ParseExpression("(x)"); 68var expression = SyntaxFactory.ParseExpression("(1, 2)");
Syntax\LambdaUtilitiesTests.cs (46)
204SyntaxFactory.ParseExpression("F(1)"), 205SyntaxFactory.ParseExpression("F(1)"))); 208SyntaxFactory.ParseExpression("F(1)"), 209SyntaxFactory.ParseExpression("F(2)"))); 212SyntaxFactory.ParseExpression("F(a => 1)"), 213SyntaxFactory.ParseExpression("F(a => 2)"))); 216SyntaxFactory.ParseExpression("F(() => 1)"), 217SyntaxFactory.ParseExpression("F(() => 2)"))); 220SyntaxFactory.ParseExpression("F(delegate { return 1; })"), 221SyntaxFactory.ParseExpression("F(delegate { return 2; })"))); 224SyntaxFactory.ParseExpression("F(delegate (int a) { return 1; })"), 225SyntaxFactory.ParseExpression("F(delegate (bool a) { return 1; })"))); 228SyntaxFactory.ParseExpression("F(delegate (int a) { return 1; })"), 229SyntaxFactory.ParseExpression("F(delegate (int a) { return 2; })"))); 232SyntaxFactory.ParseExpression("F(() => { return 1; })"), 233SyntaxFactory.ParseExpression("F(() => { return 1; })"))); 236SyntaxFactory.ParseExpression("F(() => { return 1; })"), 237SyntaxFactory.ParseExpression("F((a) => { return 1; })"))); 240SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } select a)"), 241SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } select a + 1)"))); 244SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } where a > 0 select a)"), 245SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } where a > 0 select a + 1)"))); 248SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a select a)"), 249SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a select a + 1)"))); 252SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } let b = 1 select a)"), 253SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } let b = 1 select a + 1)"))); 256SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } select a)"), 257SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } where b > 0 select a)"))); 260SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } from b in new[] { 3, 4 } where b > 0 select a)"), 261SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } from b in new[] { 3, 4, 5 } where b > 1 select a + 1)"))); 264SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } join b in new[] { 3, 4 } on a equals b select a)"), 265SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } join b in new[] { 3, 4, 5 } on a equals b select a)"))); 268SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } join b in new[] { 3, 4 } on a equals b select a)"), 269SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } join b in new[] { 3, 4 } on a + 1 equals b + 1 select a)"))); 272SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } select a)"), 273SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } join b in new[] { 3, 4 } on a equals b select a)"))); 276SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a by a into g select g)"), 277SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a + 1 by a into g select g)"))); 280SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a by a into g select g)"), 281SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a by a + 1 into g select g)"))); 284SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a by a into g select g)"), 285SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } group a by a into q select q)"))); 288SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a, a descending, a ascending select a)"), 289SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a + 1, a - 1 descending, a + 1 ascending select a)"))); 292SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a, a descending, a ascending select a)"), 293SyntaxFactory.ParseExpression("F(from a in new[] { 1, 2 } orderby a, a descending, a descending select a)")));
Syntax\SeparatedSyntaxListTests.cs (21)
53var addList = list.Insert(0, SyntaxFactory.ParseExpression("x")); 56var insertBefore = addList.Insert(0, SyntaxFactory.ParseExpression("y")); 59var insertAfter = addList.Insert(1, SyntaxFactory.ParseExpression("y")); 62var insertBetween = insertAfter.InsertRange(1, new[] { SyntaxFactory.ParseExpression("a"), SyntaxFactory.ParseExpression("b"), SyntaxFactory.ParseExpression("c") }); 69var insertAfterComment = argsWithComment.Insert(1, SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c"))); 77var insertAfterEOL = argsWithEOL.Insert(1, SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c"))); 83var insertBeforeMultiLineComment = argsWithMultiLineComment.Insert(1, SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c"))); 92SyntaxFactory.ParseExpression("A"), 93SyntaxFactory.ParseExpression("B"), 94SyntaxFactory.ParseExpression("C")] 97SyntaxFactory.ParseExpression("A"), 98SyntaxFactory.ParseExpression("B"), 99SyntaxFactory.ParseExpression("C") }); 115SyntaxNode nodeD = SyntaxFactory.ParseExpression("D"); 116SyntaxNode nodeE = SyntaxFactory.ParseExpression("E"); 244SyntaxNode nodeD = SyntaxFactory.ParseExpression("D"); 245SyntaxNode nodeE = SyntaxFactory.ParseExpression("E"); 283SyntaxFactory.ParseExpression("A+B"), 285SyntaxFactory.ParseExpression("1") });
Syntax\SyntaxFactoryTests.cs (7)
448var expression = (LiteralExpressionSyntax)SyntaxFactory.ParseExpression("1l"); 462var expression = (LiteralExpressionSyntax)SyntaxFactory.ParseExpression("1L"); 532var syntaxNode = SyntaxFactory.ParseExpression("x is int? y: z").NormalizeWhitespace(); 537var syntaxNode2 = SyntaxFactory.ParseExpression("x is DateTime? y: z").NormalizeWhitespace(); 547var syntaxNode = SyntaxFactory.ParseExpression("x is int??y").NormalizeWhitespace(); 550var syntaxNode2 = SyntaxFactory.ParseExpression("x is DateTime??y").NormalizeWhitespace(); 553var syntaxNode3 = SyntaxFactory.ParseExpression("x is object??y").NormalizeWhitespace();
Syntax\SyntaxListTests.cs (12)
48SyntaxFactory.ParseExpression("A "), 49SyntaxFactory.ParseExpression("B "), 50SyntaxFactory.ParseExpression("C ")] 53SyntaxFactory.ParseExpression("A "), 54SyntaxFactory.ParseExpression("B "), 55SyntaxFactory.ParseExpression("C ") }); 71SyntaxNode nodeD = SyntaxFactory.ParseExpression("D "); 72SyntaxNode nodeE = SyntaxFactory.ParseExpression("E "); 196SyntaxNode nodeD = SyntaxFactory.ParseExpression("D "); 197SyntaxNode nodeE = SyntaxFactory.ParseExpression("E "); 270SyntaxFactory.ParseExpression("A+B"), 272SyntaxFactory.ParseExpression("1") });
Syntax\SyntaxNodeOrTokenListTests.cs (2)
59SyntaxNodeOrToken nameE = SyntaxFactory.ParseExpression("E "); 186SyntaxNodeOrToken nodeE = SyntaxFactory.ParseExpression("E ");
Syntax\SyntaxNodeTests.cs (58)
72var expression = SyntaxFactory.ParseExpression(text); 84var expression = SyntaxFactory.ParseExpression(text); 102var expression = SyntaxFactory.ParseExpression(text); 121var expression = SyntaxFactory.ParseExpression(text); 317var expr = SyntaxFactory.ParseExpression(text); 334var expr = SyntaxFactory.ParseExpression(text); 513var expr = SyntaxFactory.ParseExpression(text); 627var expr = SyntaxFactory.ParseExpression(text); 644var expr = SyntaxFactory.ParseExpression(text); 2102var expr = SyntaxFactory.ParseExpression("a + b"); 2104var expr2 = bex.ReplaceNode(bex.Right, SyntaxFactory.ParseExpression("c")); 2111var expr = SyntaxFactory.ParseExpression("a + b + c + d"); 2125var invocation = (InvocationExpressionSyntax)SyntaxFactory.ParseExpression("m(a, b)"); 2126var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 2127var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d")); 2165var invocation = (InvocationExpressionSyntax)SyntaxFactory.ParseExpression("m(a, b)"); 2166var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 2167var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d")); 2253var expr = SyntaxFactory.ParseExpression("a + b"); 2262var expr = SyntaxFactory.ParseExpression("a + b + c"); 2379var expr = SyntaxFactory.ParseExpression("#if true\r\na + \r\n#endif\r\n + b"); 2394var expr = SyntaxFactory.ParseExpression("a + b"); 2404var expr = SyntaxFactory.ParseExpression("a + b"); 2414var ex = SyntaxFactory.ParseExpression("/* c */ identifier"); 2436var ex = SyntaxFactory.ParseExpression("/* c */ identifier"); 2477var expr = SyntaxFactory.ParseExpression("m(a, b, /* trivia */ c)"); 2491var expr = SyntaxFactory.ParseExpression(@"m(a, b, /* trivia */ 2507var expr = SyntaxFactory.ParseExpression(@"m(a, b, 2523var expr = SyntaxFactory.ParseExpression(@"SomeMethod(/*arg1:*/ a, 2541var expr = SyntaxFactory.ParseExpression(@"SomeMethod(// comment about a 2565var expr = SyntaxFactory.ParseExpression("m(a, b, /* trivia */ c)"); 2579var expr = SyntaxFactory.ParseExpression( 2595var expr = SyntaxFactory.ParseExpression( 2611var expr = SyntaxFactory.ParseExpression(@"SomeMethod(/*arg1:*/ a, 2628var expr = SyntaxFactory.ParseExpression(@"SomeMethod(// comment about a 2650var expr = SyntaxFactory.ParseExpression("m(/* before */ a /* after */)"); 2664var expr = SyntaxFactory.ParseExpression("m(/* before */ a /* after */, b, c)"); 2678var expr = SyntaxFactory.ParseExpression("m(a, b, /* before */ c /* after */)"); 3747namedNode = SyntaxFactory.ParseExpression("goo"); 3754namedNode = SyntaxFactory.ParseExpression(" goo "); 3788nodeOrToken = SyntaxFactory.ParseExpression("goo"); 3804nodeOrToken = SyntaxFactory.ParseExpression(" goo "); 3841var expression = SyntaxFactory.ParseExpression(text); 3855var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 3864var expression = (ParenthesizedLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3873var expression = (SimpleLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3882var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 3891var expression = (ParenthesizedLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3900var expression = (SimpleLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3909var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 3918var expression = (ParenthesizedLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3927var expression = (SimpleLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3936var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 3945var expression = (ParenthesizedLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3954var expression = (SimpleLambdaExpressionSyntax)SyntaxFactory.ParseExpression(text); 3963var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 3973var expression = (AnonymousMethodExpressionSyntax)SyntaxFactory.ParseExpression(text); 4001var expression = (StackAllocArrayCreationExpressionSyntax)SyntaxFactory.ParseExpression(text);
Syntax\SyntaxNormalizerTests.cs (2)
412var node = SyntaxFactory.ParseExpression(text.NormalizeLineEndings()); 5979var syntaxNode = SyntaxFactory.ParseExpression(expression).NormalizeWhitespace();
Syntax\SyntaxRewriterTests.cs (7)
327var node2 = SyntaxFactory.ParseExpression("2 + 2"); 379var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 380var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d")); 398var argC = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("c")); 399var argD = SyntaxFactory.Argument(SyntaxFactory.ParseExpression("d")); 695var red = isExpr ? (CSharpSyntaxNode)SyntaxFactory.ParseExpression(input) : SyntaxFactory.ParseStatement(input); 708var red = isExpr ? (CSharpSyntaxNode)SyntaxFactory.ParseExpression(input) : SyntaxFactory.ParseStatement(input);
Syntax\SyntaxTests.cs (1)
182var expr = SyntaxFactory.ParseExpression(source, options: TestOptions.Regular);
Syntax\TrackNodeTests.cs (13)
23var expr = SyntaxFactory.ParseExpression("a + b"); 34var expr = SyntaxFactory.ParseExpression("a + b"); 46var expr = SyntaxFactory.ParseExpression("a + b"); 55var expr = SyntaxFactory.ParseExpression("a + b"); 65var expr = SyntaxFactory.ParseExpression("a + b"); 80var expr = SyntaxFactory.ParseExpression("a + b"); 96var expr = SyntaxFactory.ParseExpression("a + b"); 108var expr = SyntaxFactory.ParseExpression("a + b"); 121var expr = SyntaxFactory.ParseExpression("a + b"); 133var expr = SyntaxFactory.ParseExpression("a + b"); 148var expr = SyntaxFactory.ParseExpression("a + b + c"); 166var expr = SyntaxFactory.ParseExpression("a + b + c"); 183var expr = SyntaxFactory.ParseExpression("a + b");
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
3675=> SyntaxFactory.ParseExpression(stringToParse);
Simplification\CSharpSimplificationService.Expander.cs (1)
1102var containingTypeSyntax = ParseExpression(containingTypeString);
Simplification\Reducers\CSharpCastReducer.Rewriter.cs (1)
61var reparsedAncestor = SyntaxFactory.ParseExpression(reducedAncestor.ToFullString());
Simplification\Simplifiers\NameSimplifier.cs (1)
667var reparsedCastExpression = ParseExpression(newCastExpression.ToString());
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
CodeGeneration\CodeGenerationTests.CSharp.cs (1)
153thisArguments: ImmutableArray.Create<SyntaxNode>(CS.SyntaxFactory.ParseExpression("42")));
Microsoft.CodeAnalysis.UnitTests (3)
CommonSyntaxTests.cs (3)
112var csharpToken = CSharp.SyntaxFactory.ParseExpression("1 + 123 /*hello*/").GetLastToken(); 208var expr = CSharp.SyntaxFactory.ParseExpression("a + b + c + d"); 229var expr = CSharp.SyntaxFactory.ParseExpression("a + b + c + d");
Microsoft.CodeAnalysis.Workspaces.UnitTests (7)
SyntaxPathTests.cs (7)
34Assert.False(path.TryResolve(SyntaxFactory.ParseExpression("Goo()"), out SyntaxNode _)); 40var node = SyntaxFactory.ParseExpression("Goo()"); 50var root = SyntaxFactory.ParseExpression("Goo(a, b)"); 53var root2 = SyntaxFactory.ParseExpression("Goo(a)"); 60var root = SyntaxFactory.ParseExpression("Goo(a)"); 63var root2 = SyntaxFactory.ParseExpression("Goo(3)"); 70var root = SyntaxFactory.ParseExpression("Goo()");
Microsoft.Interop.ComInterfaceGenerator (1)
AttributeInfo.cs (1)
19return Attribute((NameSyntax)Type.Syntax, AttributeArgumentList(SeparatedList(Arguments.Select(arg => AttributeArgument(ParseExpression(arg))))));
Microsoft.ML.AutoML (1)
Utils\Entity.cs (1)
109var exp = SyntaxFactory.ParseExpression(expression);
Microsoft.ML.InternalCodeAnalyzer (3)
ContractsCheckNameofFixProvider.cs (3)
89candidate = SyntaxFactory.ParseExpression(node.Parent.ToString()); 169var nameofExp = SyntaxFactory.ParseExpression($"nameof({name})").WithTriviaFrom(nameArg); 178var nameofExp = (InvocationExpressionSyntax)SyntaxFactory.ParseExpression($"nameof(a)").WithTriviaFrom(nameArg);
Microsoft.VisualStudio.LanguageServices.CSharp (5)
CodeModel\CSharpCodeModelService.cs (5)
1784expression: SyntaxFactory.ParseExpression(value)); 1788return SyntaxFactory.AttributeArgument(SyntaxFactory.ParseExpression(value)); 2934var expression = SyntaxFactory.ParseExpression(value); 2951var expression = SyntaxFactory.ParseExpression(value); 2968var expression = SyntaxFactory.ParseExpression(value);
System.Text.RegularExpressions.Generator (2)
UpgradeToGeneratedRegexCodeFixer.cs (2)
288return SyntaxFactory.ParseExpression(optionsLiteral); 301return SyntaxFactory.ParseExpression($"@\"{str}\"");