@@ -423,6 +423,7 @@ class ParameterNode extends AstElementNode {
423423 * Gets the `i`th child from `node` ordered by location.
424424 */
425425private AstNode getChild ( AstNode node , int i ) {
426+ shouldPrint ( node , _) and
426427 result =
427428 rank [ i ] ( AstNode child |
428429 child = node .getAChildNode ( )
@@ -444,31 +445,37 @@ private module PrettyPrinting {
444445 * These exceptions are handled in the `getQlCustomClass` predicate.
445446 */
446447 string getQlClass ( AstNode a ) {
447- not exists ( getQlCustomClass ( a ) ) and result = a .toString ( )
448- or
449- result = strictconcat ( getQlCustomClass ( a ) , " | " )
448+ shouldPrint ( a , _) and
449+ (
450+ not exists ( getQlCustomClass ( a ) ) and result = a .toString ( )
451+ or
452+ result = strictconcat ( getQlCustomClass ( a ) , " | " )
453+ )
450454 }
451455
452456 /**
453457 * Gets the QL class for `a` for the `AstNode`s where the toString method does not print the QL class.
454458 */
455459 string getQlCustomClass ( AstNode a ) {
456- a instanceof Name and
457- result = "Name" and
458- not a instanceof Parameter and
459- not a instanceof NameConstant
460- or
461- a instanceof Parameter and result = "Parameter"
462- or
463- a instanceof PlaceHolder and result = "PlaceHolder"
464- or
465- a instanceof Function and result = "Function"
466- or
467- a instanceof Class and result = "Class"
468- or
469- a instanceof Call and result = "Call"
470- or
471- a instanceof NameConstant and result = "NameConstant"
460+ shouldPrint ( a , _) and
461+ (
462+ a instanceof Name and
463+ result = "Name" and
464+ not a instanceof Parameter and
465+ not a instanceof NameConstant
466+ or
467+ a instanceof Parameter and result = "Parameter"
468+ or
469+ a instanceof PlaceHolder and result = "PlaceHolder"
470+ or
471+ a instanceof Function and result = "Function"
472+ or
473+ a instanceof Class and result = "Class"
474+ or
475+ a instanceof Call and result = "Call"
476+ or
477+ a instanceof NameConstant and result = "NameConstant"
478+ )
472479 }
473480
474481 /**
@@ -477,12 +484,15 @@ private module PrettyPrinting {
477484 * Has one and only result for every AstNode.
478485 */
479486 string prettyPrint ( AstNode a ) {
480- // this strictconcat should not be needed.
481- // However, the printAst feature breaks if this predicate has more than one result for an `AstNode`, so the strictconcat stays.
482- result = strictconcat ( reprRec ( a ) , " | " )
483- or
484- not exists ( reprRec ( a ) ) and
485- result = ""
487+ shouldPrint ( a , _) and
488+ (
489+ // this strictconcat should not be needed.
490+ // However, the printAst feature breaks if this predicate has more than one result for an `AstNode`, so the strictconcat stays.
491+ result = strictconcat ( reprRec ( a ) , " | " )
492+ or
493+ not exists ( reprRec ( a ) ) and
494+ result = ""
495+ )
486496 }
487497
488498 /**
0 commit comments