mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
C#: Address review comment
This commit is contained in:
@@ -22,10 +22,10 @@ class Element extends DotNet::Element, @element {
|
||||
* Where an element has multiple locations (for example a source file and an assembly),
|
||||
* gets only the source location.
|
||||
*/
|
||||
override Location getLocation() { result = Internal::bestLocation(this) }
|
||||
override Location getLocation() { result = ExprOrStmtParentCached::bestLocation(this) }
|
||||
|
||||
/** Gets the URL of this element. */
|
||||
string getURL() { result = Internal::getURL(this) }
|
||||
string getURL() { result = ExprOrStmtParentCached::getURL(this) }
|
||||
|
||||
/** Gets a location of this element, including sources and assemblies. */
|
||||
override Location getALocation() { none() }
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
import Stmt
|
||||
private import semmle.code.csharp.ExprOrStmtParent as ExprOrStmtParent
|
||||
private import semmle.code.csharp.ExprOrStmtParent
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
@@ -35,7 +35,7 @@ cached module Internal {
|
||||
c.getAChildStmt+() = s
|
||||
}
|
||||
|
||||
private Expr getAChildExpr(ExprOrStmtParent::ExprOrStmtParent p) {
|
||||
private Expr getAChildExpr(ExprOrStmtParent p) {
|
||||
result = p.getAChildExpr() or
|
||||
result = p.(AssignOperation).getExpandedAssignment()
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ private int getImplementationSize(ValueOrRefType t, File f) {
|
||||
result = getImplementationSize1(t, f)
|
||||
}
|
||||
|
||||
cached module Internal {
|
||||
cached module ExprOrStmtParentCached {
|
||||
cached
|
||||
ControlFlowElement getTopLevelChild(ExprOrStmtParent p, int i) {
|
||||
result = p.(MultiImplementationsParent).getBestChild(i)
|
||||
@@ -404,4 +404,4 @@ cached module Internal {
|
||||
result = ""
|
||||
}
|
||||
}
|
||||
private import Internal
|
||||
private import ExprOrStmtParentCached
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** Provides the class `ControlFlowElement`. */
|
||||
|
||||
import csharp
|
||||
private import semmle.code.csharp.ExprOrStmtParent as ExprOrStmtParent
|
||||
private import semmle.code.csharp.ExprOrStmtParent
|
||||
private import ControlFlow
|
||||
private import ControlFlow::BasicBlocks
|
||||
private import SuccessorTypes
|
||||
@@ -15,7 +15,7 @@ private import SuccessorTypes
|
||||
* control flow elements and control flow nodes. This allows control flow
|
||||
* splitting, for example modeling the control flow through `finally` blocks.
|
||||
*/
|
||||
class ControlFlowElement extends ExprOrStmtParent::ExprOrStmtParent, @control_flow_element {
|
||||
class ControlFlowElement extends ExprOrStmtParent, @control_flow_element {
|
||||
/** Gets the enclosing callable of this element, if any. */
|
||||
Callable getEnclosingCallable() { none() }
|
||||
|
||||
|
||||
@@ -1769,7 +1769,7 @@ module ControlFlow {
|
||||
* not return.
|
||||
*/
|
||||
private module NonReturning {
|
||||
private import semmle.code.csharp.ExprOrStmtParent as ExprOrStmtParent
|
||||
private import semmle.code.csharp.ExprOrStmtParent
|
||||
private import semmle.code.csharp.commons.Assertions
|
||||
private import semmle.code.csharp.frameworks.System
|
||||
|
||||
@@ -1810,7 +1810,7 @@ module ControlFlow {
|
||||
private abstract class NonReturningCallable extends Callable {
|
||||
NonReturningCallable() {
|
||||
not exists(ReturnStmt ret | ret.getEnclosingCallable() = this) and
|
||||
not ExprOrStmtParent::hasAccessorAutoImplementation(this, _) and
|
||||
not hasAccessorAutoImplementation(this, _) and
|
||||
not exists(Virtualizable v |
|
||||
v.isOverridableOrImplementable() |
|
||||
v = this or
|
||||
|
||||
Reference in New Issue
Block a user