Skip to content

Commit 6efd844

Browse files
committed
Rust: Rename into "construction" and "deconstruction"
1 parent d180900 commit 6efd844

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2947,10 +2947,10 @@ private class VariantConstructor extends Constructor instanceof Variant {
29472947
}
29482948

29492949
/**
2950-
* A matching configuration for resolving types of constructors of enums and
2950+
* A matching configuration for resolving types of constructions of enums and
29512951
* structs, such as `Result::Ok(42)`, `Foo { bar: 1 }` and `None`.
29522952
*/
2953-
private module ConstructorMatchingInput implements MatchingInputSig {
2953+
private module ConstructionMatchingInput implements MatchingInputSig {
29542954
import FunctionPositionMatchingInput
29552955

29562956
class Declaration = Constructor;
@@ -2965,7 +2965,7 @@ private module ConstructorMatchingInput implements MatchingInputSig {
29652965
abstract Type getTypeArgument(TypeArgumentPosition apos, TypePath path);
29662966

29672967
/**
2968-
* Holds if the return type of this constructor expression at `path` may
2968+
* Holds if the return type of this construction expression at `path` may
29692969
* have to be inferred from the context. For example in `Result::Ok(42)` the
29702970
* error type has to be inferred from the context.
29712971
*/
@@ -3054,23 +3054,23 @@ private module ConstructorMatchingInput implements MatchingInputSig {
30543054
}
30553055
}
30563056

3057-
private module ConstructorMatching = Matching<ConstructorMatchingInput>;
3057+
private module ConstructionMatching = Matching<ConstructionMatchingInput>;
30583058

30593059
pragma[nomagic]
3060-
private Type inferConstructorTypePreCheck(
3060+
private Type inferConstructionTypePreCheck(
30613061
AstNode n, FunctionPosition pos, boolean hasReceiver, TypePath path
30623062
) {
30633063
hasReceiver = false and
3064-
exists(ConstructorMatchingInput::Access a | n = a.getNodeAt(pos) |
3065-
result = ConstructorMatching::inferAccessType(a, pos, path)
3064+
exists(ConstructionMatchingInput::Access a | n = a.getNodeAt(pos) |
3065+
result = ConstructionMatching::inferAccessType(a, pos, path)
30663066
or
30673067
a.hasUnknownTypeAt(pos, path) and
30683068
result = TUnknownType()
30693069
)
30703070
}
30713071

3072-
private predicate inferConstructorType =
3073-
ContextTyping::CheckContextTyping<inferConstructorTypePreCheck/4>::check/2;
3072+
private predicate inferConstructionType =
3073+
ContextTyping::CheckContextTyping<inferConstructionTypePreCheck/4>::check/2;
30743074

30753075
/**
30763076
* A matching configuration for resolving types of operations like `a + b`.
@@ -3556,13 +3556,13 @@ private Type inferDereferencedExprPtrType(AstNode n, TypePath path) {
35563556
}
35573557

35583558
/**
3559-
* A matching configuration for resolving types of constructor patterns like
3559+
* A matching configuration for resolving types of deconstruction patterns like
35603560
* `let Foo { bar } = ...` or `let Some(x) = ...`.
35613561
*/
3562-
private module ConstructorPatMatchingInput implements MatchingInputSig {
3562+
private module DeconstructionPatMatchingInput implements MatchingInputSig {
35633563
import FunctionPositionMatchingInput
35643564

3565-
class Declaration = ConstructorMatchingInput::Declaration;
3565+
class Declaration = ConstructionMatchingInput::Declaration;
35663566

35673567
class Access extends Pat instanceof PathAstNode {
35683568
Access() { this instanceof TupleStructPat or this instanceof StructPat }
@@ -3596,17 +3596,17 @@ private module ConstructorPatMatchingInput implements MatchingInputSig {
35963596
}
35973597
}
35983598

3599-
private module ConstructorPatMatching = Matching<ConstructorPatMatchingInput>;
3599+
private module DeconstructionPatMatching = Matching<DeconstructionPatMatchingInput>;
36003600

36013601
/**
36023602
* Gets the type of `n` at `path`, where `n` is a pattern for a constructor,
36033603
* either a struct pattern or a tuple-struct pattern.
36043604
*/
36053605
pragma[nomagic]
3606-
private Type inferConstructorPatType(AstNode n, TypePath path) {
3607-
exists(ConstructorPatMatchingInput::Access a, FunctionPosition apos |
3606+
private Type inferDeconstructionPatType(AstNode n, TypePath path) {
3607+
exists(DeconstructionPatMatchingInput::Access a, FunctionPosition apos |
36083608
n = a.getNodeAt(apos) and
3609-
result = ConstructorPatMatching::inferAccessType(a, apos, path)
3609+
result = DeconstructionPatMatching::inferAccessType(a, apos, path)
36103610
)
36113611
}
36123612

@@ -3919,7 +3919,7 @@ private module Cached {
39193919
or
39203920
result = inferFunctionCallType(n, path)
39213921
or
3922-
result = inferConstructorType(n, path)
3922+
result = inferConstructionType(n, path)
39233923
or
39243924
result = inferOperationType(n, path)
39253925
or
@@ -3941,7 +3941,7 @@ private module Cached {
39413941
or
39423942
result = inferClosureExprType(n, path)
39433943
or
3944-
result = inferConstructorPatType(n, path)
3944+
result = inferDeconstructionPatType(n, path)
39453945
)
39463946
}
39473947
}
@@ -3990,9 +3990,9 @@ private module Debug {
39903990
t = inferFunctionCallType(n, path)
39913991
}
39923992

3993-
predicate debugInferConstructorType(AstNode n, TypePath path, Type t) {
3993+
predicate debugInferConstructionType(AstNode n, TypePath path, Type t) {
39943994
n = getRelevantLocatable() and
3995-
t = inferConstructorType(n, path)
3995+
t = inferConstructionType(n, path)
39963996
}
39973997

39983998
predicate debugTypeMention(TypeMention tm, TypePath path, Type type) {

0 commit comments

Comments
 (0)