Skip to content

Commit 17709bb

Browse files
committed
temp
1 parent ce35990 commit 17709bb

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

rust/ql/lib/codeql/rust/internal/typeinference/TypeInference.qll

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,16 @@ private predicate isPanicMacroCall(MacroExpr me) {
268268
me.getMacroCall().resolveMacro().(MacroRules).getName().getText() = "panic"
269269
}
270270

271-
private Type inferCertainStructExprType(StructExpr se, TypePath path) {
272-
result = se.getPath().(TypeMention).getTypeAt(path)
273-
}
271+
/** Module for inferring certain type information. */
272+
module CertainTypeInference {
273+
// todo: remove module wrapper
274+
Type inferCertainStructExprType(StructExpr se, TypePath path) {
275+
result = se.getPath().(TypeMention).getTypeAt(path)
276+
}
274277

275-
private Type inferCertainStructPatType(StructPat sp, TypePath path) {
276-
result = sp.getPath().(TypeMention).getTypeAt(path)
278+
Type inferCertainStructPatType(StructPat sp, TypePath path) {
279+
result = sp.getPath().(TypeMention).getTypeAt(path)
280+
}
277281
}
278282

279283
private Type inferAssignmentOperationType(AstNode n, TypePath path) {
@@ -386,6 +390,13 @@ private class NonAssocCallExpr extends CallExpr {
386390
}
387391
}
388392

393+
/**
394+
* Provides functionality related to context-based typing of calls.
395+
*/
396+
private module ContextTyping {
397+
// todo: remove
398+
}
399+
389400
/**
390401
* Holds if the type path `path` pointing to `type` is stripped of any leading
391402
* complex root type allowed for `self` parameters, such as `&`, `Box`, `Rc`,
@@ -2167,6 +2178,7 @@ private TupleType inferArgList(ArgList args, TypePath path) {
21672178

21682179
cached
21692180
private module Cached {
2181+
// todo: remove module wrapper
21702182
/** Holds if `n` is implicitly dereferenced and/or borrowed. */
21712183
cached
21722184
predicate implicitDerefChainBorrow(Expr e, DerefChain derefChain, boolean borrow) {
@@ -2993,9 +3005,9 @@ private module Input3 implements InputSig3 {
29933005
result = inferRefExprType(n) and
29943006
path.isEmpty()
29953007
or
2996-
result = inferCertainStructExprType(n, path)
3008+
result = CertainTypeInference::inferCertainStructExprType(n, path)
29973009
or
2998-
result = inferCertainStructPatType(n, path)
3010+
result = CertainTypeInference::inferCertainStructPatType(n, path)
29993011
or
30003012
result = inferRangeExprType(n) and
30013013
path.isEmpty()

0 commit comments

Comments
 (0)