@@ -185,30 +185,12 @@ internal ExpressionNodeData(object o, (string aggregatePath, string pathFromPare
185185 IsDeclaration = isParameterDeclaration ;
186186
187187 // fill the Name and Closure properties, for expressions
188- string staticTypename = "" ;
189- switch ( expr ) {
190- case ParameterExpression pexpr :
191- Name = pexpr . Name ;
192- break ;
193- case MemberExpression mexpr :
194- if ( mexpr . Expression == null ) {
195- staticTypename = mexpr . Member . DeclaringType . FriendlyName ( language ) + "." ;
196- }
197- Name = staticTypename + mexpr . Member . Name ;
198- var expressionType = mexpr . Expression ? . Type ;
199- if ( expressionType . IsClosureClass ( ) ) {
200- Closure = expressionType . FriendlyName ( language ) ;
201- }
202- break ;
203- case MethodCallExpression callexpr :
204- if ( callexpr . Object == null ) {
205- staticTypename = callexpr . Method . DeclaringType . FriendlyName ( language ) + "." ;
206- }
207- Name = staticTypename + callexpr . Method . Name ;
208- break ;
209- case LambdaExpression lambdaExpression :
210- Name = lambdaExpression . Name ;
211- break ;
188+ Name = expr . Name ( language ) ;
189+
190+ if ( expr is MemberExpression mexpr &&
191+ mexpr . Expression ? . Type is Type expressionType &&
192+ expressionType . IsClosureClass ( ) ) {
193+ Closure = expressionType . Name ;
212194 }
213195
214196 object value = null ;
@@ -227,8 +209,8 @@ internal ExpressionNodeData(object o, (string aggregatePath, string pathFromPare
227209 EndNodeType = ClosedVar ;
228210 break ;
229211 case DefaultExpression defexpr :
230- EndNodeType = Default ;
231212 value = defexpr . ExtractValue ( ) ;
213+ EndNodeType = Default ;
232214 break ;
233215 }
234216 if ( EndNodeType != null ) { visualizerData . CollectedEndNodes . Add ( this ) ; }
@@ -247,7 +229,6 @@ internal ExpressionNodeData(object o, (string aggregatePath, string pathFromPare
247229 Name = mbind . Member . Name ;
248230 break ;
249231 case CallSiteBinder callSiteBinder :
250- ReflectionTypeName = callSiteBinder . GetType ( ) . Name ;
251232 NodeType = callSiteBinder . BinderType ( ) ;
252233 break ;
253234 default :
@@ -273,7 +254,7 @@ internal ExpressionNodeData(object o, (string aggregatePath, string pathFromPare
273254
274255 // populate Children
275256 var type = o . GetType ( ) ;
276- var preferredOrder = preferredPropertyOrders . FirstOrDefault ( x => x . Item1 . IsAssignableFrom ( type ) ) . Item2 ;
257+ var preferredOrder = PreferredPropertyOrders . FirstOrDefault ( x => x . Item1 . IsAssignableFrom ( type ) ) . Item2 ;
277258 Children = type . GetProperties ( )
278259 . Where ( prp =>
279260 ! ( prp . DeclaringType . Name == "BlockExpression" && prp . Name == "Result" ) &&
@@ -317,23 +298,6 @@ internal ExpressionNodeData(object o, (string aggregatePath, string pathFromPare
317298 }
318299 }
319300
320- private static List < ( Type , string [ ] ) > preferredPropertyOrders = new List < ( Type , string [ ] ) > {
321- ( typeof ( LambdaExpression ) , new [ ] { "Parameters" , "Body" } ) ,
322- ( typeof ( BinaryExpression ) , new [ ] { "Left" , "Right" , "Conversion" } ) ,
323- ( typeof ( BlockExpression ) , new [ ] { "Variables" , "Expressions" } ) ,
324- ( typeof ( CatchBlock ) , new [ ] { "Variable" , "Filter" , "Body" } ) ,
325- ( typeof ( ConditionalExpression ) , new [ ] { "Test" , "IfTrue" , "IfFalse" } ) ,
326- ( typeof ( IndexExpression ) , new [ ] { "Object" , "Arguments" } ) ,
327- ( typeof ( InvocationExpression ) , new [ ] { "Arguments" , "Expression" } ) ,
328- ( typeof ( ListInitExpression ) , new [ ] { "NewExpression" , "Initializers" } ) ,
329- ( typeof ( MemberInitExpression ) , new [ ] { "NewExpression" , "Bindings" } ) ,
330- ( typeof ( MethodCallExpression ) , new [ ] { "Object" , "Arguments" } ) ,
331- ( typeof ( SwitchCase ) , new [ ] { "TestValues" , "Body" } ) ,
332- ( typeof ( SwitchExpression ) , new [ ] { "SwitchValue" , "Cases" , "DefaultBody" } ) ,
333- ( typeof ( TryExpression ) , new [ ] { "Body" , "Handlers" , "Finally" , "Fault" } ) ,
334- ( typeof ( DynamicExpression ) , new [ ] { "Binder" , "Arguments" } )
335- } ;
336-
337301 private static Dictionary < Type , List < ( string @namespace , string typename ) > > baseTypes = new Dictionary < Type , List < ( string @namespace , string typename ) > > ( ) ;
338302
339303 private static Dictionary < Type , string [ ] > factoryMethods = typeof ( Expression ) . GetMethods ( )
0 commit comments