11// Copyright (c) .NET Foundation and contributors. All rights reserved. 
22// Licensed under the MIT license. See LICENSE file in the project root for full license information. 
33
4+ using  System ; 
45using  System . Collections . Generic ; 
56using  System . Diagnostics ; 
67using  System . Diagnostics . CodeAnalysis ; 
@@ -27,18 +28,19 @@ internal partial struct HandleCallAction
2728		ValueSetLattice < SingleValue >  _multiValueLattice ; 
2829
2930		public  HandleCallAction  ( 
30- 			in   DiagnosticContext   diagnosticContext , 
31+ 			Location   location , 
3132			ISymbol  owningSymbol , 
3233			IOperation  operation , 
33- 			ValueSetLattice < SingleValue >  multiValueLattice ) 
34+ 			ValueSetLattice < SingleValue >  multiValueLattice , 
35+ 			Action < Diagnostic > ?  reportDiagnostic ) 
3436		{ 
3537			_owningSymbol  =  owningSymbol ; 
3638			_operation  =  operation ; 
3739			_isNewObj  =  operation . Kind  ==  OperationKind . ObjectCreation ; 
38- 			_diagnosticContext  =  diagnosticContext ; 
40+ 			_diagnosticContext  =  new   DiagnosticContext   ( location ,   reportDiagnostic ) ; 
3941			_annotations  =  FlowAnnotations . Instance ; 
40- 			_reflectionAccessAnalyzer  =  default ; 
41- 			_requireDynamicallyAccessedMembersAction  =  new  ( diagnosticContext ,  _reflectionAccessAnalyzer ) ; 
42+ 			_reflectionAccessAnalyzer  =  new   ( reportDiagnostic ) ; 
43+ 			_requireDynamicallyAccessedMembersAction  =  new  ( _diagnosticContext ,  _reflectionAccessAnalyzer ) ; 
4244			_multiValueLattice  =  multiValueLattice ; 
4345		} 
4446
@@ -201,25 +203,25 @@ private partial bool TryResolveTypeNameForCreateInstanceAndMark (in MethodProxy
201203		} 
202204
203205		private  partial  void  MarkStaticConstructor  ( TypeProxy  type ) 
204- 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForConstructorsOnType  ( _diagnosticContext ,  type . Type ,  BindingFlags . Static ,  parameterCount :  0 ) ; 
206+ 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForConstructorsOnType  ( _diagnosticContext . Location ,  type . Type ,  BindingFlags . Static ,  parameterCount :  0 ) ; 
205207
206208		private  partial  void  MarkEventsOnTypeHierarchy  ( TypeProxy  type ,  string  name ,  BindingFlags ?  bindingFlags ) 
207- 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForEventsOnTypeHierarchy  ( _diagnosticContext ,  type . Type ,  name ,  bindingFlags ) ; 
209+ 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForEventsOnTypeHierarchy  ( _diagnosticContext . Location ,  type . Type ,  name ,  bindingFlags ) ; 
208210
209211		private  partial  void  MarkFieldsOnTypeHierarchy  ( TypeProxy  type ,  string  name ,  BindingFlags ?  bindingFlags ) 
210- 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForFieldsOnTypeHierarchy  ( _diagnosticContext ,  type . Type ,  name ,  bindingFlags ) ; 
212+ 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForFieldsOnTypeHierarchy  ( _diagnosticContext . Location ,  type . Type ,  name ,  bindingFlags ) ; 
211213
212214		private  partial  void  MarkPropertiesOnTypeHierarchy  ( TypeProxy  type ,  string  name ,  BindingFlags ?  bindingFlags ) 
213- 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForPropertiesOnTypeHierarchy  ( _diagnosticContext ,  type . Type ,  name ,  bindingFlags ) ; 
215+ 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForPropertiesOnTypeHierarchy  ( _diagnosticContext . Location ,  type . Type ,  name ,  bindingFlags ) ; 
214216
215217		private  partial  void  MarkPublicParameterlessConstructorOnType  ( TypeProxy  type ) 
216- 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForPublicParameterlessConstructor  ( _diagnosticContext ,  type . Type ) ; 
218+ 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForPublicParameterlessConstructor  ( _diagnosticContext . Location ,  type . Type ) ; 
217219
218220		private  partial  void  MarkConstructorsOnType  ( TypeProxy  type ,  BindingFlags ?  bindingFlags ,  int ?  parameterCount ) 
219- 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForConstructorsOnType  ( _diagnosticContext ,  type . Type ,  bindingFlags ,  parameterCount ) ; 
221+ 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForConstructorsOnType  ( _diagnosticContext . Location ,  type . Type ,  bindingFlags ,  parameterCount ) ; 
220222
221223		private  partial  void  MarkMethod  ( MethodProxy  method ) 
222- 			=>  ReflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForMethod  ( _diagnosticContext ,  method . Method ) ; 
224+ 			=>  _reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForMethod  ( _diagnosticContext . Location ,  method . Method ) ; 
223225
224226		// TODO: Does the analyzer need to do something here? 
225227		private  partial  void  MarkType  ( TypeProxy  type )  {  } 
@@ -229,7 +231,7 @@ private partial bool MarkAssociatedProperty (MethodProxy method)
229231			if  ( method . Method . MethodKind  ==  MethodKind . PropertyGet  ||  method . Method . MethodKind  ==  MethodKind . PropertySet )  { 
230232				var  property  =  ( IPropertySymbol )  method . Method . AssociatedSymbol ! ; 
231233				Debug . Assert  ( property  !=  null ) ; 
232- 				ReflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForProperty  ( _diagnosticContext ,  property ! ) ; 
234+ 				_reflectionAccessAnalyzer . GetReflectionAccessDiagnosticsForProperty  ( _diagnosticContext . Location ,  property ! ) ; 
233235				return  true ; 
234236			} 
235237
0 commit comments