176 references to GetConstantValue
Microsoft.CodeAnalysis.CodeStyle (2)
Microsoft.CodeAnalysis.CSharp.CodeStyle (6)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Features (11)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (33)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (48)
Compilation\SemanticModelAPITests.cs (38)
1437var constantInfo = speculativeModel.GetConstantValue(expr);
1475var constantInfo = speculativeModel.GetConstantValue(expr);
1523var constantInfo = speculativeModel.GetConstantValue(expr);
1611var constantInfo = speculativeModel.GetConstantValue(expr);
1696var constantInfo = speculativeModel.GetConstantValue(expr);
2785var constantVal = speculativeModel.GetConstantValue(switchLabel.Value);
3912var value0 = model.GetConstantValue(init0);
3921var value1 = model.GetConstantValue(init1);
3928var value2 = model.GetConstantValue(init2);
4108Assert.True(model.GetConstantValue(actual[0]).HasValue);
4109Assert.Equal("Hello, world!", model.GetConstantValue(actual[0]).Value);
4110Assert.False(model.GetConstantValue(actual[1]).HasValue);
4146Assert.Equal("Number 3", model.GetConstantValue(actual[0]).Value);
4149Assert.Equal("Level 5 Number 3", model.GetConstantValue(actual[1]).Value);
4151Assert.False(model.GetConstantValue(actual[2]).HasValue);
4154Assert.Equal("Testing", model.GetConstantValue(actual[3]).Value);
4157Assert.Equal("ConstantInterpolatedString", model.GetConstantValue(actual[4]).Value);
4160Assert.Equal("Level 5", model.GetConstantValue(actual[5]).Value);
4163Assert.Equal("Radio Noise", model.GetConstantValue(actual[6]).Value);
4166Assert.Equal("Level 5", model.GetConstantValue(actual[7]).Value);
4188Assert.True(model.GetConstantValue(actual[0]).HasValue);
4189Assert.Equal("Hello, world!", model.GetConstantValue(actual[0]).Value);
4191Assert.False(model.GetConstantValue(actual[1]).HasValue);
4213Assert.True(model.GetConstantValue(actual[0]).HasValue);
4214Assert.Equal(0, model.GetConstantValue(actual[0]).Value);
4217Assert.True(model.GetConstantValue(actual[1]).HasValue);
4218Assert.Equal(true, model.GetConstantValue(actual[1]).Value);
4241Assert.True(model.GetConstantValue(actual[0]).HasValue);
4242Assert.Null(model.GetConstantValue(actual[0]).Value);
4279Assert.Equal("Number 3", model.GetConstantValue(actual[0]).Value);
4283Assert.Equal("Level 5 Number 3", model.GetConstantValue(actual[1]).Value);
4286Assert.False(model.GetConstantValue(actual[2]).HasValue);
4290Assert.Equal("Testing", model.GetConstantValue(actual[3]).Value);
4294Assert.Equal("ConstantInterpolatedString", model.GetConstantValue(actual[4]).Value);
4298Assert.Equal("Level 5", model.GetConstantValue(actual[5]).Value);
4302Assert.Equal("Radio Noise", model.GetConstantValue(actual[6]).Value);
4306Assert.Equal("Level 5", model.GetConstantValue(actual[7]).Value);
4460Assert.Equal("DEBUG", model.GetConstantValue(root.DescendantNodes().OfType<InvocationExpressionSyntax>().Single()));
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
Microsoft.CodeAnalysis.Features (10)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (1)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (48)
Semantics\NameOfTests.vb (36)
59Assert.Equal("MaxValue", model.GetConstantValue(node1).Value)
96Assert.Null(model.GetConstantValue(node2).Value)
124Assert.Equal("Variant", model.GetConstantValue(node3).Value)
456Assert.Equal("System", model.GetConstantValue(node1).Value)
528Assert.Equal("M1", model.GetConstantValue(node1).Value)
867Assert.Equal("C3", model.GetConstantValue(node1).Value)
944Assert.Equal("CC3", model.GetConstantValue(node1).Value)
1057Assert.Equal("CC3", model.GetConstantValue(node1).Value)
1125Assert.Equal("alias", model.GetConstantValue(node1).Value)
1190Assert.Equal("M1", model.GetConstantValue(node1).Value)
1272Assert.Equal("P1", model.GetConstantValue(node1).Value)
1354Assert.Equal("F1", model.GetConstantValue(node1).Value)
1435Assert.Equal("E1", model.GetConstantValue(node1).Value)
1515Assert.Equal("Missing", model.GetConstantValue(node1).Value)
1646Assert.Equal("Ambiguous", model.GetConstantValue(node1).Value)
1739Assert.Equal("LOCAL", model.GetConstantValue(node1).Value)
1796Assert.Equal("LOCAL", model.GetConstantValue(node1).Value)
1853Assert.Equal("LOCAL", model.GetConstantValue(node1).Value)
1910Assert.Equal("LOCAL", model.GetConstantValue(node1).Value)
2052Assert.Equal("F1", model.GetConstantValue(node1).Value)
2151Assert.Equal("P1", model.GetConstantValue(node1).Value)
2252Assert.Equal("M1", model.GetConstantValue(node1).Value)
2358Assert.Equal("M1", model.GetConstantValue(node1).Value)
2462Assert.Equal("E1", model.GetConstantValue(node1).Value)
2795Assert.Equal("MTest", model.GetConstantValue(node1).Value)
2870Assert.Equal("MTest", model.GetConstantValue(node1).Value)
2935Assert.Equal("MTest", model.GetConstantValue(node1).Value)
2998Assert.Equal("MTest", model.GetConstantValue(node1).Value)
3059Assert.Equal("MTest", model.GetConstantValue(node1).Value)
3120Assert.Equal("MTest", model.GetConstantValue(node1).Value)
3180Assert.Equal("MTest", model.GetConstantValue(node1).Value)
3243Assert.Equal("M1", model.GetConstantValue(node1).Value)
3304Assert.Equal("F1", model.GetConstantValue(node1).Value)
3361Assert.Equal("F1", model.GetConstantValue(node1).Value)
3420Assert.Equal("MTest", model.GetConstantValue(node1).Value)
3476Assert.Equal("MTest", model.GetConstantValue(node1).Value)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (1)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (2)
Microsoft.VisualStudio.LanguageServices.CSharp (2)
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)