@@ -82,6 +82,18 @@ module Trees {
82
82
}
83
83
}
84
84
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
+
85
97
abstract class ScriptBlockTree extends ControlFlowTree instanceof ScriptBlock {
86
98
abstract predicate succEntry ( AstNode n , Completion c ) ;
87
99
@@ -353,6 +365,11 @@ module Trees {
353
365
last ( super .getIterator ( ) , pred , c ) and
354
366
completionIsNormal ( c ) and
355
367
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 )
356
373
}
357
374
}
358
375
@@ -421,6 +438,16 @@ module Trees {
421
438
}
422
439
}
423
440
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
+
424
451
class IfStmtTree extends PreOrderTree instanceof IfStmt {
425
452
final override predicate propagatesAbnormal ( AstNode child ) {
426
453
child = super .getACondition ( )
@@ -541,11 +568,33 @@ module Trees {
541
568
override AstNode getChildNode ( int i ) { i = 0 and result = super .getOperand ( ) }
542
569
}
543
570
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
+
544
591
class ArrayLiteralTree extends StandardPostOrderTree instanceof ArrayLiteral {
545
592
override AstNode getChildNode ( int i ) { result = super .getElement ( i ) }
546
593
}
547
594
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
+ }
549
598
550
599
class CatchClauseTree extends PreOrderTree instanceof CatchClause {
551
600
final override predicate propagatesAbnormal ( Ast child ) { none ( ) }
@@ -584,6 +633,10 @@ module Trees {
584
633
}
585
634
}
586
635
636
+ class TypeConstraintTree extends LeafTree instanceof TypeConstraint { }
637
+
638
+ class TypeTree extends LeafTree instanceof Type { }
639
+
587
640
class TryStmtBlock extends PreOrderTree instanceof TryStmt {
588
641
final override predicate propagatesAbnormal ( AstNode child ) { child = super .getFinally ( ) }
589
642
@@ -616,19 +669,71 @@ module Trees {
616
669
}
617
670
}
618
671
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
+
619
692
class ThrowStmtTree extends StandardPreOrderTree instanceof ThrowStmt {
620
693
override AstNode getChildNode ( int i ) { i = 0 and result = super .getPipeline ( ) }
621
694
}
622
695
623
696
class ConstExprTree extends LeafTree instanceof ConstExpr { }
624
697
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
+
625
712
class CmdExprTree extends StandardPreOrderTree instanceof CmdExpr {
626
713
override AstNode getChildNode ( int i ) { i = 0 and result = super .getExpr ( ) }
627
714
}
628
715
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
+
629
726
class PipelineTree extends StandardPreOrderTree instanceof Pipeline {
630
727
override AstNode getChildNode ( int i ) { result = super .getComponent ( i ) }
631
728
}
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
+ }
632
737
}
633
738
634
739
private import Scope
0 commit comments