@@ -32,7 +32,10 @@ private predicate shouldPrint(Element e, Location l) {
3232}
3333
3434private predicate isImplicitExpression ( ControlFlowElement element ) {
35- element .( Expr ) .isImplicit ( ) and not exists ( element .getAChild ( ) )
35+ element .( Expr ) .isImplicit ( ) and
36+ not element instanceof CastExpr and
37+ not element .( OperatorCall ) .getTarget ( ) instanceof ImplicitConversionOperator and
38+ not element instanceof ElementInitializer
3639}
3740
3841private predicate isFilteredCompilerGenerated ( Declaration d ) {
@@ -291,18 +294,6 @@ class ControlFlowElementNode extends ElementNode {
291294 controlFlowElement = element and
292295 // Removing implicit expressions
293296 not isImplicitExpression ( element ) and
294- // Removing extra nodes that are generated for an `AssignOperation`
295- not exists ( AssignOperation ao |
296- ao .hasExpandedAssignment ( ) and
297- (
298- ao .getExpandedAssignment ( ) = controlFlowElement or
299- ao .getExpandedAssignment ( ) .getRValue ( ) = controlFlowElement or
300- ao .getExpandedAssignment ( ) .getRValue ( ) .( BinaryOperation ) .getLeftOperand ( ) =
301- controlFlowElement .getParent * ( ) or
302- ao .getExpandedAssignment ( ) .getRValue ( ) .( OperatorCall ) .getChild ( 0 ) =
303- controlFlowElement .getParent * ( )
304- )
305- ) and
306297 not isNotNeeded ( element .getParent + ( ) ) and
307298 // LambdaExpr is both a Callable and a ControlFlowElement,
308299 // print it with the more specific CallableNode
@@ -429,7 +420,7 @@ final class DeclarationWithAccessorsNode extends ElementNode {
429420 result .( ParametersNode ) .getParameterizable ( ) = declaration
430421 or
431422 childIndex = 2 and
432- result .( ElementNode ) .getElement ( ) = declaration .( Property ) .getInitializer ( ) . getParent ( )
423+ result .( ElementNode ) .getElement ( ) = declaration .( Property ) .getInitializer ( )
433424 or
434425 result .( ElementNode ) .getElement ( ) =
435426 rank [ childIndex - 2 ] ( Element a , string file , int line , int column , string name |
@@ -462,12 +453,7 @@ final class FieldNode extends ElementNode {
462453 result .( AttributesNode ) .getAttributable ( ) = field
463454 or
464455 childIndex = 1 and
465- field .hasInitializer ( ) and
466- (
467- if field .getDeclaringType ( ) instanceof Enum
468- then result .( ElementNode ) .getElement ( ) = field .getInitializer ( )
469- else result .( ElementNode ) .getElement ( ) = field .getInitializer ( ) .getParent ( )
470- )
456+ result .( ElementNode ) .getElement ( ) = field .getInitializer ( )
471457 }
472458}
473459
0 commit comments