56 references to SemanticModel
Microsoft.AspNetCore.App.Analyzers (5)
RouteEmbeddedLanguage\RoutePatternAnalyzer.cs (5)
29var semanticModel = context.SemanticModel; 34var routeUsageCache = RouteUsageCache.GetOrCreate(context.SemanticModel.Compilation); 47if (!RouteStringSyntaxDetector.IsRouteStringSyntaxToken(token, context.SemanticModel, cancellationToken, out var options)) 62Location.Create(context.SemanticModel.SyntaxTree, diag.Span), 105Location.Create(context.SemanticModel.SyntaxTree, unusedParameter.Span),
Microsoft.AspNetCore.App.Analyzers.Test (1)
Infrastructure\WellKnownTypesTests.cs (1)
113var semanticModel = context.SemanticModel;
Microsoft.CodeAnalysis (3)
DiagnosticAnalyzer\CompilerDiagnosticAnalyzer.CompilationAnalyzer.cs (2)
41var declDiagnostics = context.SemanticModel.GetDeclarationDiagnostics(context.FilterSpan, context.CancellationToken); 42var bodyDiagnostics = context.SemanticModel.GetMethodBodyDiagnostics(context.FilterSpan, context.CancellationToken);
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (1)
705/// Syntax tree for the <see cref="SemanticModel"/> being analyzed.
Microsoft.CodeAnalysis.CodeStyle (5)
src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (1)
91=> ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, notification, context.CancellationToken);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (2)
87var tree = context.SemanticModel.SyntaxTree; 90var unnecessaryImports = UnnecessaryImportsProvider.GetUnnecessaryImports(context.SemanticModel, context.FilterSpan, cancellationToken);
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (1)
273var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.SemanticModel.SyntaxTree, syntaxTree => (new StrongBox<bool>(true), null));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (1)
157=> context.SemanticModel.SyntaxTree.FindNode(context.FilterSpan, findInTrivia, getInnermostNodeForTie, context.CancellationToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle (6)
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (5)
91var root = context.SemanticModel.SyntaxTree.GetCompilationUnitRoot(context.CancellationToken); 93using (var simplifier = new NullableImpactingSpanWalker(context.SemanticModel, positionOfFirstReducingNullableDirective, ignoredSpans: codeBlockIntervalTree, context.CancellationToken)) 105var compilationOptions = ((CSharpCompilationOptions)context.SemanticModel.Compilation.Options).NullableContextOptions; 308var syntaxTreeState = GetOrCreateSyntaxTreeState(context.SemanticModel.SyntaxTree, defaultCompleted: true, context.SemanticModel, context.CancellationToken);
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
45var semanticModel = context.SemanticModel;
Microsoft.CodeAnalysis.CSharp.Features (8)
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (2)
70if (ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, GetAllNotifications(options), context.CancellationToken)) 73var simplifier = new TypeSyntaxSimplifierWalker(this, context.SemanticModel, options, context.Options, ignoredSpans: codeBlockIntervalTree, context.CancellationToken);
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (5)
91var root = context.SemanticModel.SyntaxTree.GetCompilationUnitRoot(context.CancellationToken); 93using (var simplifier = new NullableImpactingSpanWalker(context.SemanticModel, positionOfFirstReducingNullableDirective, ignoredSpans: codeBlockIntervalTree, context.CancellationToken)) 105var compilationOptions = ((CSharpCompilationOptions)context.SemanticModel.Compilation.Options).NullableContextOptions; 308var syntaxTreeState = GetOrCreateSyntaxTreeState(context.SemanticModel.SyntaxTree, defaultCompleted: true, context.SemanticModel, context.CancellationToken);
src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
45var semanticModel = context.SemanticModel;
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (3)
CodeFixes\CodeFixServiceTests.cs (1)
1202var variableDeclarations = context.SemanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax>();
Diagnostics\DiagnosticAnalyzerServiceTests.cs (2)
924context.RegisterSemanticModelAction(c => c.ReportDiagnostic(Diagnostic.Create(s_semanticRule, c.SemanticModel.SyntaxTree.GetRoot().GetLocation()))); 940context.RegisterSemanticModelAction(c => c.ReportDiagnostic(Diagnostic.Create(s_semanticRule, c.SemanticModel.SyntaxTree.GetRoot().GetLocation())));
Microsoft.CodeAnalysis.Features (12)
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDetectionAnalyzer.cs (2)
54var detector = JsonLanguageDetector.GetOrCreate(context.SemanticModel.Compilation, _info); 83detector.TryParseString(token, context.SemanticModel, includeProbableStrings: false, cancellationToken) == null &&
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDiagnosticAnalyzer.cs (3)
47var detector = JsonLanguageDetector.GetOrCreate(context.SemanticModel.Compilation, _info); 73var tree = detector.TryParseString(token, context.SemanticModel, includeProbableStrings: false, cancellationToken); 80Location.Create(context.SemanticModel.SyntaxTree, diag.Span),
EmbeddedLanguages\RegularExpressions\LanguageServices\AbstractRegexDiagnosticAnalyzer.cs (3)
42var semanticModel = context.SemanticModel; 85var tree = detector.TryParseString(token, context.SemanticModel, cancellationToken); 92Location.Create(context.SemanticModel.SyntaxTree, diag.Span),
src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (1)
91=> ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, notification, context.CancellationToken);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (2)
87var tree = context.SemanticModel.SyntaxTree; 90var unnecessaryImports = UnnecessaryImportsProvider.GetUnnecessaryImports(context.SemanticModel, context.FilterSpan, cancellationToken);
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (1)
273var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.SemanticModel.SyntaxTree, syntaxTree => (new StrongBox<bool>(true), null));
Microsoft.CodeAnalysis.Test.Utilities (7)
Diagnostics\CommonDiagnosticAnalyzers.cs (7)
1107Diagnostic.Create(Descriptor, context.SemanticModel.SyntaxTree.GetRoot().GetLocation()))); 1565sortedCallbackSemanticModelPaths.Add($"{context.SemanticModel.SyntaxTree.FilePath}(IsGeneratedCode:{context.IsGeneratedCode})")); 2745ReportDiagnosticsInAllTrees("RegisterSemanticModelAction", semanticModelContext.SemanticModel.SyntaxTree, semanticModelContext.SemanticModel.Compilation, semanticModelContext.ReportDiagnostic)); 2946context.RegisterSemanticModelAction(context => HandleCallback(context.SemanticModel.SyntaxTree.GetRoot().GetLocation(), context.SemanticModel.Compilation, context.ReportDiagnostic, context.CancellationToken)); 3027context.RegisterSemanticModelAction(semanticModelContext => AnalyzedSemanticModels.Add(semanticModelContext.SemanticModel));
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\AnalysisContextInfoTests.cs (1)
78c.RegisterSemanticModelAction(b => ThrowIfMatch(nameof(c.RegisterSemanticModelAction), new AnalysisContextInfo(b.SemanticModel)));
Microsoft.CodeAnalysis.VisualBasic.Features (3)
Diagnostics\Analyzers\VisualBasicSimplifyTypeNamesDiagnosticAnalyzer.vb (3)
56If (ShouldSkipAnalysis(context.FilterTree, context.Options, context.SemanticModel.Compilation.Options, GetAllNotifications(simplifierOptions), context.CancellationToken)) Then 60Dim configOptions = context.Options.AnalyzerConfigOptionsProvider.GetOptions(context.SemanticModel.SyntaxTree) 61Dim simplifier As New TypeSyntaxSimplifierWalker(Me, context.SemanticModel, simplifierOptions, context.Options, ignoredSpans:=codeBlockIntervalTree, context.CancellationToken)
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (1)
157=> context.SemanticModel.SyntaxTree.FindNode(context.FilterSpan, findInTrivia, getInnermostNodeForTie, context.CancellationToken);
Microsoft.ML.InternalCodeAnalyzer (1)
BestFriendAnalyzer.cs (1)
50var model = context.SemanticModel;