@@ -580,21 +580,7 @@ module Trees {
580580
581581 private class CharacterTree extends LeafTree , CharacterLiteral { }
582582
583- private class ClassDeclarationTree extends BodyStmtTree , ClassDeclaration {
584- final override predicate first ( AstNode first ) {
585- this .firstInner ( first )
586- or
587- not exists ( this .getAChild ( _) ) and
588- first = this
589- }
590-
591- final override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
592- BodyStmtTree .super .succ ( pred , succ , c )
593- or
594- succ = this and
595- this .lastInner ( pred , c )
596- }
597-
583+ private class ClassDeclarationTree extends NamespaceTree , ClassDeclaration {
598584 /** Gets the `i`th child in the body of this block. */
599585 final override AstNode getBodyChild ( int i , boolean rescuable ) {
600586 result = this .getScopeExpr ( ) and i = 0 and rescuable = false
@@ -603,8 +589,10 @@ module Trees {
603589 i = count ( this .getScopeExpr ( ) ) and
604590 rescuable = true
605591 or
606- result = this .getStmt ( i - count ( this .getScopeExpr ( ) ) - count ( this .getSuperclassExpr ( ) ) ) and
607- rescuable = true
592+ result =
593+ NamespaceTree .super
594+ .getBodyChild ( i - count ( this .getScopeExpr ( ) ) - count ( this .getSuperclassExpr ( ) ) ,
595+ rescuable )
608596 }
609597 }
610598
@@ -934,7 +922,16 @@ module Trees {
934922 }
935923 }
936924
937- private class ModuleDeclarationTree extends BodyStmtTree , ModuleDeclaration {
925+ private class ModuleDeclarationTree extends NamespaceTree , ModuleDeclaration {
926+ /** Gets the `i`th child in the body of this block. */
927+ final override AstNode getBodyChild ( int i , boolean rescuable ) {
928+ result = this .getScopeExpr ( ) and i = 0 and rescuable = false
929+ or
930+ result = NamespaceTree .super .getBodyChild ( i - count ( this .getScopeExpr ( ) ) , rescuable )
931+ }
932+ }
933+
934+ private class NamespaceTree extends BodyStmtTree , Namespace {
938935 final override predicate first ( AstNode first ) {
939936 this .firstInner ( first )
940937 or
@@ -948,13 +945,6 @@ module Trees {
948945 succ = this and
949946 this .lastInner ( pred , c )
950947 }
951-
952- /** Gets the `i`th child in the body of this block. */
953- final override AstNode getBodyChild ( int i , boolean rescuable ) {
954- result = this .getScopeExpr ( ) and i = 0 and rescuable = false
955- or
956- result = BodyStmtTree .super .getBodyChild ( i - count ( this .getScopeExpr ( ) ) , rescuable )
957- }
958948 }
959949
960950 private class NilTree extends LeafTree , NilLiteral { }
0 commit comments