Skip to content

Commit d216460

Browse files
committed
python: unnecessary abstract class
It is enough to make the predicates abstract, so the whole -`Impl`-construction was unnecessary.
1 parent 5094897 commit d216460

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

python/ql/lib/semmle/python/Stmts.qll

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -146,24 +146,8 @@ class Exec extends Exec_ {
146146
/**
147147
* An exception handler such as an `except` or an `except*` statement
148148
* in a `try` statement.
149-
*
150-
* We do not wish to expose an abstract class that users are not
151-
* meant to extend, so this class is kept private. The user facing
152-
* class is `ExceptionHandler`.
153149
*/
154-
abstract private class ExceptionHandlerImpl extends Stmt {
155-
/** Gets the name of this except group block. */
156-
abstract Expr getName();
157-
158-
/** Gets the type of this except group block. */
159-
abstract Expr getType();
160-
}
161-
162-
/**
163-
* An exception handler such as an `except` or an `except*` statement
164-
* in a `try` statement.
165-
*/
166-
class ExceptionHandler extends Stmt instanceof ExceptionHandlerImpl {
150+
class ExceptionHandler extends Stmt {
167151
ExceptionHandler() {
168152
this instanceof ExceptStmt_
169153
or
@@ -174,14 +158,14 @@ class ExceptionHandler extends Stmt instanceof ExceptionHandlerImpl {
174158
Try getTry() { result.getAHandler() = this }
175159

176160
/** Gets the name of this except group block. */
177-
Expr getName() { result = super.getName() }
161+
abstract Expr getName();
178162

179163
/** Gets the type of this except group block. */
180-
Expr getType() { result = super.getType() }
164+
abstract Expr getType();
181165
}
182166

183167
/** An except group statement (part of a `try` statement), such as `except* IOError as err:` */
184-
class ExceptGroupStmt extends ExceptGroupStmt_, ExceptionHandlerImpl {
168+
class ExceptGroupStmt extends ExceptGroupStmt_, ExceptionHandler {
185169
/* syntax: except Expr [ as Expr ]: */
186170
override Expr getASubExpression() {
187171
result = this.getName()
@@ -203,7 +187,7 @@ class ExceptGroupStmt extends ExceptGroupStmt_, ExceptionHandlerImpl {
203187
}
204188

205189
/** An except statement (part of a `try` statement), such as `except IOError as err:` */
206-
class ExceptStmt extends ExceptStmt_, ExceptionHandlerImpl {
190+
class ExceptStmt extends ExceptStmt_, ExceptionHandler {
207191
/* syntax: except Expr [ as Expr ]: */
208192
override Expr getASubExpression() {
209193
result = this.getName()

0 commit comments

Comments
 (0)