mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Rust: Rename predicates
This commit is contained in:
@@ -31,7 +31,7 @@ class StreamCipherInit extends Cryptography::CryptographicOperation::Range {
|
||||
// extract the algorithm name from the type of `ce` or its receiver.
|
||||
exists(Type t, TypePath tp |
|
||||
t = inferType([ce, ce.(MethodCallExpr).getReceiver()], tp) and
|
||||
rawAlgorithmName = t.(StructType).asStruct().(Addressable).getCanonicalPath().splitAt("::")
|
||||
rawAlgorithmName = t.(StructType).getStruct().(Addressable).getCanonicalPath().splitAt("::")
|
||||
) and
|
||||
algorithmName = simplifyAlgorithmName(rawAlgorithmName) and
|
||||
// only match a known cryptographic algorithm
|
||||
|
||||
@@ -134,8 +134,8 @@ class StructType extends Type, TStruct {
|
||||
|
||||
StructType() { this = TStruct(struct) }
|
||||
|
||||
/** Get the struct that this struct type represents. */
|
||||
Struct asStruct() { result = struct }
|
||||
/** Gets the struct that this struct type represents. */
|
||||
Struct getStruct() { result = struct }
|
||||
|
||||
override TypeParameter getPositionalTypeParameter(int i) {
|
||||
result = TTypeParamTypeParameter(struct.getGenericParamList().getTypeParam(i))
|
||||
@@ -205,8 +205,8 @@ class UnionType extends Type, TUnion {
|
||||
|
||||
UnionType() { this = TUnion(union) }
|
||||
|
||||
/** Get the union that this union type represents. */
|
||||
Union asUnion() { result = union }
|
||||
/** Gets the union that this union type represents. */
|
||||
Union getUnion() { result = union }
|
||||
|
||||
override TypeParameter getPositionalTypeParameter(int i) {
|
||||
result = TTypeParamTypeParameter(union.getGenericParamList().getTypeParam(i))
|
||||
|
||||
@@ -1173,8 +1173,8 @@ private Type inferCallExprBaseType(AstNode n, TypePath path) {
|
||||
path = TypePath::cons(TRefTypeParameter(), path0)
|
||||
else (
|
||||
not (
|
||||
argType.(StructType).asStruct() instanceof StringStruct and
|
||||
result.(StructType).asStruct() instanceof Builtins::Str
|
||||
argType.(StructType).getStruct() instanceof StringStruct and
|
||||
result.(StructType).getStruct() instanceof Builtins::Str
|
||||
) and
|
||||
(
|
||||
not path0.isCons(TRefTypeParameter(), _) and
|
||||
@@ -1889,8 +1889,8 @@ final class MethodCall extends Call {
|
||||
//
|
||||
// See also https://doc.rust-lang.org/reference/expressions/method-call-expr.html#r-expr.method.autoref-deref
|
||||
path.isEmpty() and
|
||||
t0.(StructType).asStruct() instanceof StringStruct and
|
||||
result.(StructType).asStruct() instanceof Builtins::Str
|
||||
t0.(StructType).getStruct() instanceof StringStruct and
|
||||
result.(StructType).getStruct() instanceof Builtins::Str
|
||||
)
|
||||
else result = this.getReceiverTypeAt(path)
|
||||
}
|
||||
@@ -2519,8 +2519,8 @@ private module Cached {
|
||||
cached
|
||||
StructField resolveStructFieldExpr(FieldExpr fe) {
|
||||
exists(string name, Type ty | ty = getFieldExprLookupType(fe, name) |
|
||||
result = ty.(StructType).asStruct().getStructField(name) or
|
||||
result = ty.(UnionType).asUnion().getStructField(name)
|
||||
result = ty.(StructType).getStruct().getStructField(name) or
|
||||
result = ty.(UnionType).getUnion().getStructField(name)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2530,7 +2530,7 @@ private module Cached {
|
||||
cached
|
||||
TupleField resolveTupleFieldExpr(FieldExpr fe) {
|
||||
exists(int i |
|
||||
result = getTupleFieldExprLookupType(fe, i).(StructType).asStruct().getTupleField(i)
|
||||
result = getTupleFieldExprLookupType(fe, i).(StructType).getStruct().getTupleField(i)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user