@@ -82,6 +82,18 @@ module Trees {
8282 }
8383 }
8484
85+ class AttributeTree extends StandardPostOrderTree instanceof Attribute {
86+ override AstNode getChildNode ( int i ) {
87+ result = super .getPositionalArgument ( i )
88+ or
89+ exists ( int n |
90+ n = super .getNumberOfPositionalArguments ( ) and
91+ i >= n and
92+ result = super .getNamedArgument ( i - n )
93+ )
94+ }
95+ }
96+
8597 abstract class ScriptBlockTree extends ControlFlowTree instanceof ScriptBlock {
8698 abstract predicate succEntry ( AstNode n , Completion c ) ;
8799
@@ -353,6 +365,11 @@ module Trees {
353365 last ( super .getIterator ( ) , pred , c ) and
354366 completionIsNormal ( c ) and
355367 first ( super .getCondition ( ) , succ )
368+ or
369+ // Body -> condition
370+ last ( this .getBody ( ) , pred , c ) and
371+ c .continuesLoop ( ) and
372+ first ( super .getCondition ( ) , succ )
356373 }
357374 }
358375
@@ -421,6 +438,16 @@ module Trees {
421438 }
422439 }
423440
441+ class MemberExprTree extends StandardPostOrderTree instanceof MemberExpr {
442+ override AstNode getChildNode ( int i ) {
443+ i = 0 and result = super .getBase ( )
444+ or
445+ i = 1 and result = super .getMember ( )
446+ }
447+ }
448+
449+ class CmdParameterTree extends LeafTree instanceof CmdParameter { }
450+
424451 class IfStmtTree extends PreOrderTree instanceof IfStmt {
425452 final override predicate propagatesAbnormal ( AstNode child ) {
426453 child = super .getACondition ( )
@@ -541,11 +568,33 @@ module Trees {
541568 override AstNode getChildNode ( int i ) { i = 0 and result = super .getOperand ( ) }
542569 }
543570
571+ class ScriptBlockExprTree extends LeafTree instanceof ScriptBlockExpr { }
572+
573+ class ConvertExprTree extends StandardPostOrderTree instanceof ConvertExpr {
574+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
575+ }
576+
577+ class IndexExprTree extends StandardPostOrderTree instanceof IndexExpr {
578+ override AstNode getChildNode ( int i ) {
579+ i = 0 and result = super .getBase ( )
580+ or
581+ i = 1 and result = super .getIndex ( )
582+ }
583+ }
584+
585+ class ParenExprTree extends StandardPostOrderTree instanceof ParenExpr {
586+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
587+ }
588+
589+ class TypeNameExprTree extends LeafTree instanceof TypeNameExpr { }
590+
544591 class ArrayLiteralTree extends StandardPostOrderTree instanceof ArrayLiteral {
545592 override AstNode getChildNode ( int i ) { result = super .getElement ( i ) }
546593 }
547594
548- class TypeConstraintTree extends LeafTree instanceof TypeConstraint { }
595+ class ArrayExprTree extends StandardPostOrderTree instanceof ArrayExpr {
596+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getStmtBlock ( ) }
597+ }
549598
550599 class CatchClauseTree extends PreOrderTree instanceof CatchClause {
551600 final override predicate propagatesAbnormal ( Ast child ) { none ( ) }
@@ -584,6 +633,10 @@ module Trees {
584633 }
585634 }
586635
636+ class TypeConstraintTree extends LeafTree instanceof TypeConstraint { }
637+
638+ class TypeTree extends LeafTree instanceof Type { }
639+
587640 class TryStmtBlock extends PreOrderTree instanceof TryStmt {
588641 final override predicate propagatesAbnormal ( AstNode child ) { child = super .getFinally ( ) }
589642
@@ -616,19 +669,71 @@ module Trees {
616669 }
617670 }
618671
672+ class ExpandableSubExprTree extends StandardPostOrderTree instanceof ExpandableSubExpr {
673+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
674+ }
675+
676+ class ExpandableStringExprTree extends StandardPostOrderTree instanceof ExpandableStringExpr {
677+ override AstNode getChildNode ( int i ) { result = super .getExpr ( i ) }
678+ }
679+
680+ class ReturnStmtTree extends StandardPreOrderTree instanceof ReturnStmt {
681+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getPipeline ( ) }
682+ }
683+
684+ class ExitStmtTre extends StandardPreOrderTree instanceof ExitStmt {
685+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getPipeline ( ) }
686+ }
687+
688+ class ExitStmtTree extends StandardPreOrderTree instanceof ExitStmt {
689+ override AstNode getChildNode ( int i ) { i = 0 and result = super .getPipeline ( ) }
690+ }
691+
619692 class ThrowStmtTree extends StandardPreOrderTree instanceof ThrowStmt {
620693 override AstNode getChildNode ( int i ) { i = 0 and result = super .getPipeline ( ) }
621694 }
622695
623696 class ConstExprTree extends LeafTree instanceof ConstExpr { }
624697
698+ class HashTableTree extends StandardPostOrderTree instanceof HashTableExpr {
699+ override AstNode getChildNode ( int i ) {
700+ exists ( int k |
701+ // First evaluate the key
702+ i = 2 * k and
703+ super .hasEntry ( k , result , _)
704+ or
705+ // Then evaluate the value
706+ i = 2 * k + 1 and
707+ super .hasEntry ( k , _, result )
708+ )
709+ }
710+ }
711+
625712 class CmdExprTree extends StandardPreOrderTree instanceof CmdExpr {
626713 override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
627714 }
628715
716+ class CmdTree extends StandardPostOrderTree instanceof Cmd {
717+ override AstNode getChildNode ( int i ) {
718+ i = - 1 and result = super .getCommand ( )
719+ or
720+ result = super .getArgument ( i )
721+ }
722+ }
723+
724+ class StringConstTree extends LeafTree instanceof StringConstExpr { }
725+
629726 class PipelineTree extends StandardPreOrderTree instanceof Pipeline {
630727 override AstNode getChildNode ( int i ) { result = super .getComponent ( i ) }
631728 }
729+
730+ class InvokeMemberExprTree extends StandardPostOrderTree instanceof InvokeMemberExpr {
731+ override AstNode getChildNode ( int i ) {
732+ i = - 1 and result = super .getQualifier ( )
733+ or
734+ result = super .getArgument ( i )
735+ }
736+ }
632737}
633738
634739private import Scope
0 commit comments