зеркало из https://github.com/github/codeql.git
Swift: Revert `Impl` rename for manually added files
This commit is contained in:
Родитель
4ab5a1a060
Коммит
c785cd9d7b
|
@ -14,7 +14,7 @@ private import codeql.swift.elements.decl.NominalTypeDecl
|
|||
* }
|
||||
* ```
|
||||
*/
|
||||
class ClassOrStructDecl extends NominalTypeDecl {
|
||||
final class ClassOrStructDecl extends NominalTypeDecl {
|
||||
ClassOrStructDecl() {
|
||||
this instanceof ClassDecl
|
||||
or
|
|
@ -12,7 +12,7 @@ private Decl getAMember(Decl ctx) {
|
|||
/**
|
||||
* A function that is a member of a class, struct, enum or protocol.
|
||||
*/
|
||||
class Method extends Function {
|
||||
final class Method extends Function {
|
||||
Method() {
|
||||
this = getAMember(any(ClassDecl c))
|
||||
or
|
|
@ -9,7 +9,7 @@ private import codeql.swift.elements.expr.DotSyntaxCallExpr
|
|||
* a + b
|
||||
* ```
|
||||
*/
|
||||
class ArithmeticOperation extends Expr {
|
||||
final class ArithmeticOperation extends Expr {
|
||||
ArithmeticOperation() {
|
||||
this instanceof BinaryArithmeticOperation or
|
||||
this instanceof UnaryArithmeticOperation
|
||||
|
@ -31,7 +31,7 @@ class ArithmeticOperation extends Expr {
|
|||
* a + b
|
||||
* ```
|
||||
*/
|
||||
class BinaryArithmeticOperation extends BinaryExpr {
|
||||
final class BinaryArithmeticOperation extends BinaryExpr {
|
||||
BinaryArithmeticOperation() {
|
||||
this instanceof AddExpr or
|
||||
this instanceof SubExpr or
|
||||
|
@ -48,7 +48,7 @@ class BinaryArithmeticOperation extends BinaryExpr {
|
|||
* a &+ b
|
||||
* ```
|
||||
*/
|
||||
class AddExpr extends BinaryExpr {
|
||||
final class AddExpr extends BinaryExpr {
|
||||
AddExpr() { this.getStaticTarget().getName() = ["+(_:_:)", "&+(_:_:)"] }
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ class AddExpr extends BinaryExpr {
|
|||
* a &- b
|
||||
* ```
|
||||
*/
|
||||
class SubExpr extends BinaryExpr {
|
||||
final class SubExpr extends BinaryExpr {
|
||||
SubExpr() { this.getStaticTarget().getName() = ["-(_:_:)", "&-(_:_:)"] }
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ class SubExpr extends BinaryExpr {
|
|||
* a &* b
|
||||
* ```
|
||||
*/
|
||||
class MulExpr extends BinaryExpr {
|
||||
final class MulExpr extends BinaryExpr {
|
||||
MulExpr() { this.getStaticTarget().getName() = ["*(_:_:)", "&*(_:_:)"] }
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ class MulExpr extends BinaryExpr {
|
|||
* a / b
|
||||
* ```
|
||||
*/
|
||||
class DivExpr extends BinaryExpr {
|
||||
final class DivExpr extends BinaryExpr {
|
||||
DivExpr() { this.getStaticTarget().getName() = "/(_:_:)" }
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ class DivExpr extends BinaryExpr {
|
|||
* a % b
|
||||
* ```
|
||||
*/
|
||||
class RemExpr extends BinaryExpr {
|
||||
final class RemExpr extends BinaryExpr {
|
||||
RemExpr() { this.getStaticTarget().getName() = "%(_:_:)" }
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ class RemExpr extends BinaryExpr {
|
|||
* -a
|
||||
* ```
|
||||
*/
|
||||
class UnaryArithmeticOperation extends PrefixUnaryExpr {
|
||||
final class UnaryArithmeticOperation extends PrefixUnaryExpr {
|
||||
UnaryArithmeticOperation() {
|
||||
this instanceof UnaryMinusExpr or
|
||||
this instanceof UnaryPlusExpr
|
||||
|
@ -113,7 +113,7 @@ class UnaryArithmeticOperation extends PrefixUnaryExpr {
|
|||
* -a
|
||||
* ```
|
||||
*/
|
||||
class UnaryMinusExpr extends PrefixUnaryExpr {
|
||||
final class UnaryMinusExpr extends PrefixUnaryExpr {
|
||||
UnaryMinusExpr() { this.getStaticTarget().getName() = "-(_:)" }
|
||||
}
|
||||
|
||||
|
@ -123,6 +123,6 @@ class UnaryMinusExpr extends PrefixUnaryExpr {
|
|||
* +a
|
||||
* ```
|
||||
*/
|
||||
class UnaryPlusExpr extends PrefixUnaryExpr {
|
||||
final class UnaryPlusExpr extends PrefixUnaryExpr {
|
||||
UnaryPlusExpr() { this.getStaticTarget().getName() = "+(_:)" }
|
||||
}
|
|
@ -10,7 +10,7 @@ private import codeql.swift.elements.expr.PrefixUnaryExpr
|
|||
* ~a
|
||||
* ```
|
||||
*/
|
||||
class BitwiseOperation extends Expr {
|
||||
final class BitwiseOperation extends Expr {
|
||||
BitwiseOperation() {
|
||||
this instanceof BinaryBitwiseOperation or
|
||||
this instanceof UnaryBitwiseOperation
|
||||
|
@ -33,7 +33,7 @@ class BitwiseOperation extends Expr {
|
|||
* a .^ b
|
||||
* ```
|
||||
*/
|
||||
class BinaryBitwiseOperation extends BinaryExpr {
|
||||
final class BinaryBitwiseOperation extends BinaryExpr {
|
||||
BinaryBitwiseOperation() {
|
||||
this instanceof AndBitwiseExpr or
|
||||
this instanceof OrBitwiseExpr or
|
||||
|
@ -52,7 +52,7 @@ class BinaryBitwiseOperation extends BinaryExpr {
|
|||
* a & b
|
||||
* ```
|
||||
*/
|
||||
class AndBitwiseExpr extends BinaryExpr {
|
||||
final class AndBitwiseExpr extends BinaryExpr {
|
||||
AndBitwiseExpr() { this.getStaticTarget().getName() = "&(_:_:)" }
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ class AndBitwiseExpr extends BinaryExpr {
|
|||
* a | b
|
||||
* ```
|
||||
*/
|
||||
class OrBitwiseExpr extends BinaryExpr {
|
||||
final class OrBitwiseExpr extends BinaryExpr {
|
||||
OrBitwiseExpr() { this.getStaticTarget().getName() = "|(_:_:)" }
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ class OrBitwiseExpr extends BinaryExpr {
|
|||
* a ^ b
|
||||
* ```
|
||||
*/
|
||||
class XorBitwiseExpr extends BinaryExpr {
|
||||
final class XorBitwiseExpr extends BinaryExpr {
|
||||
XorBitwiseExpr() { this.getStaticTarget().getName() = "^(_:_:)" }
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ class XorBitwiseExpr extends BinaryExpr {
|
|||
* a .& b
|
||||
* ```
|
||||
*/
|
||||
class PointwiseAndExpr extends BinaryExpr {
|
||||
final class PointwiseAndExpr extends BinaryExpr {
|
||||
PointwiseAndExpr() { this.getOperator().getName() = ".&(_:_:)" }
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ class PointwiseAndExpr extends BinaryExpr {
|
|||
* a .| b
|
||||
* ```
|
||||
*/
|
||||
class PointwiseOrExpr extends BinaryExpr {
|
||||
final class PointwiseOrExpr extends BinaryExpr {
|
||||
PointwiseOrExpr() { this.getOperator().getName() = ".|(_:_:)" }
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ class PointwiseOrExpr extends BinaryExpr {
|
|||
* a .^ b
|
||||
* ```
|
||||
*/
|
||||
class PointwiseXorExpr extends BinaryExpr {
|
||||
final class PointwiseXorExpr extends BinaryExpr {
|
||||
PointwiseXorExpr() { this.getOperator().getName() = ".^(_:_:)" }
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ class PointwiseXorExpr extends BinaryExpr {
|
|||
* a &<<
|
||||
* ```
|
||||
*/
|
||||
class ShiftLeftBitwiseExpr extends BinaryExpr {
|
||||
final class ShiftLeftBitwiseExpr extends BinaryExpr {
|
||||
ShiftLeftBitwiseExpr() { this.getStaticTarget().getName() = ["<<(_:_:)", "&<<(_:_:)"] }
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ class ShiftLeftBitwiseExpr extends BinaryExpr {
|
|||
* a &>>
|
||||
* ```
|
||||
*/
|
||||
class ShiftRightBitwiseExpr extends BinaryExpr {
|
||||
final class ShiftRightBitwiseExpr extends BinaryExpr {
|
||||
ShiftRightBitwiseExpr() { this.getStaticTarget().getName() = [">>(_:_:)", "&>>(_:_:)"] }
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ class ShiftRightBitwiseExpr extends BinaryExpr {
|
|||
* ~a
|
||||
* ```
|
||||
*/
|
||||
class UnaryBitwiseOperation extends PrefixUnaryExpr instanceof NotBitwiseExpr { }
|
||||
final class UnaryBitwiseOperation extends PrefixUnaryExpr instanceof NotBitwiseExpr { }
|
||||
|
||||
/**
|
||||
* A bitwise NOT expression.
|
||||
|
@ -142,6 +142,6 @@ class UnaryBitwiseOperation extends PrefixUnaryExpr instanceof NotBitwiseExpr {
|
|||
* ~a
|
||||
* ```
|
||||
*/
|
||||
class NotBitwiseExpr extends PrefixUnaryExpr {
|
||||
final class NotBitwiseExpr extends PrefixUnaryExpr {
|
||||
NotBitwiseExpr() { this.getStaticTarget().getName() = "~(_:)" }
|
||||
}
|
|
@ -19,7 +19,7 @@ private import codeql.swift.elements.decl.EnumElementDecl
|
|||
* ...
|
||||
* ```
|
||||
*/
|
||||
class EnumElementExpr extends Expr {
|
||||
final class EnumElementExpr extends Expr {
|
||||
EnumElementDecl decl;
|
||||
|
||||
EnumElementExpr() {
|
|
@ -2,8 +2,8 @@ private import codeql.swift.elements.expr.MethodCallExpr
|
|||
private import codeql.swift.elements.expr.InitializerLookupExpr
|
||||
private import codeql.swift.elements.decl.Initializer
|
||||
|
||||
class InitializerCallExpr extends MethodCallExpr {
|
||||
final class InitializerCallExpr extends MethodCallExpr {
|
||||
InitializerCallExpr() { this.getFunction() instanceof InitializerLookupExpr }
|
||||
|
||||
override Initializer getStaticTarget() { result = super.getStaticTarget() }
|
||||
Initializer getStaticTarget() { result = super.getStaticTarget() }
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
private import codeql.swift.elements.expr.MethodLookupExpr
|
||||
private import codeql.swift.elements.expr.MethodLookupExprImpl::Impl as Impl
|
||||
private import codeql.swift.elements.decl.Initializer
|
||||
|
||||
final private class InitializerLookupExprImpl extends Impl::MethodLookupExpr {
|
||||
InitializerLookupExprImpl() { super.getMethod() instanceof Initializer }
|
||||
|
||||
override string toString() { result = this.getMember().toString() }
|
||||
}
|
||||
|
||||
final class InitializerLookupExpr extends MethodLookupExpr, InitializerLookupExprImpl {
|
||||
Initializer getMethod() { result = super.getMethod() }
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
private import codeql.swift.elements.expr.MethodLookupExpr
|
||||
private import codeql.swift.elements.decl.Initializer
|
||||
|
||||
class InitializerLookupExpr extends MethodLookupExpr {
|
||||
InitializerLookupExpr() { super.getMethod() instanceof Initializer }
|
||||
|
||||
override Initializer getMethod() { result = super.getMethod() }
|
||||
|
||||
override string toString() { result = this.getMember().toString() }
|
||||
}
|
|
@ -10,28 +10,28 @@ private predicate unaryHasName(PrefixUnaryExpr e, string name) {
|
|||
|
||||
private predicate binaryHasName(BinaryExpr e, string name) { e.getStaticTarget().getName() = name }
|
||||
|
||||
class LogicalAndExpr extends BinaryExpr {
|
||||
final class LogicalAndExpr extends BinaryExpr {
|
||||
LogicalAndExpr() { binaryHasName(this, "&&(_:_:)") }
|
||||
}
|
||||
|
||||
class LogicalOrExpr extends BinaryExpr {
|
||||
final class LogicalOrExpr extends BinaryExpr {
|
||||
LogicalOrExpr() { binaryHasName(this, "||(_:_:)") }
|
||||
}
|
||||
|
||||
class BinaryLogicalOperation extends BinaryExpr {
|
||||
final class BinaryLogicalOperation extends BinaryExpr {
|
||||
BinaryLogicalOperation() {
|
||||
this instanceof LogicalAndExpr or
|
||||
this instanceof LogicalOrExpr
|
||||
}
|
||||
}
|
||||
|
||||
class NotExpr extends PrefixUnaryExpr {
|
||||
final class NotExpr extends PrefixUnaryExpr {
|
||||
NotExpr() { unaryHasName(this, "!(_:)") }
|
||||
}
|
||||
|
||||
class UnaryLogicalOperation extends PrefixUnaryExpr instanceof NotExpr { }
|
||||
final class UnaryLogicalOperation extends PrefixUnaryExpr instanceof NotExpr { }
|
||||
|
||||
class LogicalOperation extends Expr {
|
||||
final class LogicalOperation extends Expr {
|
||||
LogicalOperation() {
|
||||
this instanceof BinaryLogicalOperation or
|
||||
this instanceof UnaryLogicalOperation
|
|
@ -1,9 +1,10 @@
|
|||
private import ApplyExprExt
|
||||
private import codeql.swift.elements.expr.CallExpr
|
||||
private import codeql.swift.elements.expr.ApplyExpr
|
||||
private import codeql.swift.elements.expr.SuperRefExpr
|
||||
private import codeql.swift.elements.expr.SelfRefExpr
|
||||
|
||||
class MethodCallExpr extends CallExpr, MethodApplyExpr {
|
||||
final class MethodCallExpr extends CallExpr, MethodApplyExpr {
|
||||
predicate isSelfCall() { this.getQualifier() instanceof SelfRefExpr }
|
||||
|
||||
predicate isSuperCall() { this.getQualifier() instanceof SuperRefExpr }
|
|
@ -8,6 +8,6 @@ private import codeql.swift.elements.expr.BinaryExpr
|
|||
/**
|
||||
* A Swift nil-coalesing expr (`??`).
|
||||
*/
|
||||
class NilCoalescingExpr extends BinaryExpr {
|
||||
final class NilCoalescingExpr extends BinaryExpr {
|
||||
NilCoalescingExpr() { this.getStaticTarget().getName() = "??(_:_:)" }
|
||||
}
|
|
@ -3,7 +3,7 @@ private import codeql.swift.elements.decl.Method
|
|||
private import codeql.swift.elements.decl.VarDecl
|
||||
|
||||
/** A reference to `self`. */
|
||||
class SelfRefExpr extends DeclRefExpr {
|
||||
final class SelfRefExpr extends DeclRefExpr {
|
||||
Method method;
|
||||
|
||||
SelfRefExpr() { this.getDecl() = method.getSelfParam() }
|
|
@ -4,7 +4,7 @@ private import swift
|
|||
* A floating-point type. This includes the `Float` type, the `Double`, and
|
||||
* builtin floating-point types.
|
||||
*/
|
||||
class FloatingPointType extends Type {
|
||||
final class FloatingPointType extends Type {
|
||||
FloatingPointType() {
|
||||
this.getName() = ["Float", "Double"] or
|
||||
this instanceof BuiltinFloatType
|
||||
|
@ -12,14 +12,14 @@ class FloatingPointType extends Type {
|
|||
}
|
||||
|
||||
/** The `Character` type. */
|
||||
class CharacterType extends StructType {
|
||||
final class CharacterType extends StructType {
|
||||
CharacterType() { this.getName() = "Character" }
|
||||
}
|
||||
|
||||
/**
|
||||
* An integer-like type. For example, `Int`, `Int16`, `Uint16`, etc.
|
||||
*/
|
||||
class IntegralType extends Type {
|
||||
final class IntegralType extends Type {
|
||||
IntegralType() {
|
||||
this.getName() =
|
||||
["Int", "Int8", "Int16", "Int32", "Int64", "UInt", "UInt8", "UInt16", "UInt32", "UInt64"]
|
||||
|
@ -29,14 +29,14 @@ class IntegralType extends Type {
|
|||
}
|
||||
|
||||
/** The `Bool` type. */
|
||||
class BoolType extends Type {
|
||||
final class BoolType extends Type {
|
||||
BoolType() { this.getName() = "Bool" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A numeric type. This includes the integer and floating point types.
|
||||
*/
|
||||
class NumericType extends Type {
|
||||
final class NumericType extends Type {
|
||||
NumericType() {
|
||||
this instanceof IntegralType or
|
||||
this instanceof FloatingPointType
|
Загрузка…
Ссылка в новой задаче