mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Rust: fix QL compilation errors after renames
This commit is contained in:
@@ -329,7 +329,7 @@ module ExprTrees {
|
||||
}
|
||||
|
||||
class FieldExprTree extends StandardPostOrderTree instanceof FieldExpr {
|
||||
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
|
||||
override AstNode getChildNode(int i) { i = 0 and result = super.getContainer() }
|
||||
}
|
||||
|
||||
class IfExprTree extends PostOrderTree instanceof IfExpr {
|
||||
|
||||
@@ -150,7 +150,7 @@ final class TuplePositionContent extends FieldContent, TTuplePositionContent {
|
||||
|
||||
override FieldExprCfgNode getAnAccess() {
|
||||
// TODO: limit to tuple types
|
||||
result.getNameRef().getText().toInt() = pos
|
||||
result.getIdentifier().getText().toInt() = pos
|
||||
}
|
||||
|
||||
override string toString() { result = "tuple." + pos.toString() }
|
||||
@@ -262,7 +262,7 @@ newtype TContent =
|
||||
TTuplePositionContent(int pos) {
|
||||
pos in [0 .. max([
|
||||
any(TuplePat pat).getNumberOfFields(),
|
||||
any(FieldExpr access).getNameRef().getText().toInt()
|
||||
any(FieldExpr access).getIdentifier().getText().toInt()
|
||||
]
|
||||
)]
|
||||
} or
|
||||
|
||||
@@ -688,7 +688,7 @@ module RustDataFlow implements InputSig<Location> {
|
||||
node1.asPat().(RefPatCfgNode).getPat() = node2.asPat()
|
||||
or
|
||||
exists(FieldExprCfgNode access |
|
||||
node1.asExpr() = access.getExpr() and
|
||||
node1.asExpr() = access.getContainer() and
|
||||
node2.asExpr() = access and
|
||||
access = c.(FieldContent).getAnAccess()
|
||||
)
|
||||
@@ -771,7 +771,7 @@ module RustDataFlow implements InputSig<Location> {
|
||||
exists(AssignmentExprCfgNode assignment, FieldExprCfgNode access |
|
||||
assignment.getLhs() = access and
|
||||
node1.asExpr() = assignment.getRhs() and
|
||||
node2.asExpr() = access.getExpr() and
|
||||
node2.asExpr() = access.getContainer() and
|
||||
access = c.getAnAccess()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ module Input implements InputSig<Location, RustDataFlow> {
|
||||
private class MethodCallExprNameRef extends SourceBase, SinkBase {
|
||||
private MethodCallExpr call;
|
||||
|
||||
MethodCallExprNameRef() { this = call.getNameRef() }
|
||||
MethodCallExprNameRef() { this = call.getIdentifier() }
|
||||
|
||||
override MethodCallExpr getCall() { result = call }
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ newtype TNode =
|
||||
e =
|
||||
[
|
||||
any(IndexExprCfgNode i).getBase(), //
|
||||
any(FieldExprCfgNode access).getExpr(), //
|
||||
any(FieldExprCfgNode access).getContainer(), //
|
||||
any(TryExprCfgNode try).getExpr(), //
|
||||
any(PrefixExprCfgNode pe | pe.getOperatorName() = "*").getExpr(), //
|
||||
any(AwaitExprCfgNode a).getExpr(), any(MethodCallExprCfgNode mc).getReceiver(), //
|
||||
|
||||
@@ -30,8 +30,8 @@ module Impl {
|
||||
|
||||
override string toStringImpl() {
|
||||
exists(string abbr, string name |
|
||||
abbr = this.getExpr().toAbbreviatedString() and
|
||||
name = this.getNameRef().getText() and
|
||||
abbr = this.getContainer().toAbbreviatedString() and
|
||||
name = this.getIdentifier().getText() and
|
||||
if abbr = "..." then result = "... ." + name else result = abbr + "." + name
|
||||
)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ module Impl {
|
||||
exists(string base, string separator |
|
||||
base = this.getReceiver().toAbbreviatedString() and
|
||||
(if base = "..." then separator = " ." else separator = ".") and
|
||||
result = base + separator + this.getNameRef().toStringImpl() + "(...)"
|
||||
result = base + separator + this.getIdentifier().toStringImpl() + "(...)"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ module Impl {
|
||||
* Gets the text of this path, if it exists.
|
||||
*/
|
||||
pragma[nomagic]
|
||||
string getText() { result = this.getSegment().getNameRef().getText() }
|
||||
string getText() { result = this.getSegment().getIdentifier().getText() }
|
||||
}
|
||||
|
||||
/** A simple identifier path. */
|
||||
@@ -54,7 +54,7 @@ module Impl {
|
||||
not ps.hasParenthesizedArgList() and
|
||||
not ps.hasTypeRepr() and
|
||||
not ps.hasReturnTypeSyntax() and
|
||||
name = ps.getNameRef().getText()
|
||||
name = ps.getIdentifier().getText()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ module Impl {
|
||||
|
||||
private string toAbbreviatedStringPart(int index) {
|
||||
index = 0 and
|
||||
if this.hasTypeRepr() then result = "<...>" else result = this.getNameRef().getText()
|
||||
if this.hasTypeRepr() then result = "<...>" else result = this.getIdentifier().getText()
|
||||
or
|
||||
index = 1 and result = this.getGenericArgList().toAbbreviatedString()
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ module Impl {
|
||||
override string toStringImpl() { result = concat(int i | | this.toStringPart(i) order by i) }
|
||||
|
||||
private string toStringPart(int index) {
|
||||
index = 0 and result = this.getNameRef().getText()
|
||||
index = 0 and result = this.getIdentifier().getText()
|
||||
or
|
||||
index = 1 and this.hasNameRef() and result = ": "
|
||||
index = 1 and this.hasIdentifier() and result = ": "
|
||||
or
|
||||
index = 2 and
|
||||
result = this.getExpr().toAbbreviatedString()
|
||||
@@ -44,9 +44,9 @@ module Impl {
|
||||
* ```
|
||||
*/
|
||||
string getFieldName() {
|
||||
result = this.getNameRef().getText()
|
||||
result = this.getIdentifier().getText()
|
||||
or
|
||||
not this.hasNameRef() and
|
||||
not this.hasIdentifier() and
|
||||
result = this.getExpr().(PathExpr).getPath().(PathImpl::IdentPath).getName()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ module Impl {
|
||||
/** Gets the record field named `name`, if any. */
|
||||
pragma[nomagic]
|
||||
StructField getStructField(string name) {
|
||||
result = this.getFieldList().(RecordFieldList).getAField() and
|
||||
result = this.getFieldList().(StructFieldList).getAField() and
|
||||
result.getName().getText() = name
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ module Impl {
|
||||
override string toStringImpl() { result = concat(int i | | this.toStringPart(i) order by i) }
|
||||
|
||||
private string toStringPart(int index) {
|
||||
index = 0 and result = this.getNameRef().getText()
|
||||
index = 0 and result = this.getIdentifier().getText()
|
||||
or
|
||||
index = 1 and this.hasNameRef() and result = ": "
|
||||
index = 1 and this.hasIdentifier() and result = ": "
|
||||
or
|
||||
index = 2 and
|
||||
result = this.getPat().toAbbreviatedString()
|
||||
@@ -43,9 +43,9 @@ module Impl {
|
||||
* ```
|
||||
*/
|
||||
string getFieldName() {
|
||||
result = this.getNameRef().getText()
|
||||
result = this.getIdentifier().getText()
|
||||
or
|
||||
not this.hasNameRef() and
|
||||
not this.hasIdentifier() and
|
||||
result = this.getPat().(IdentPat).getName().getText()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ module Impl {
|
||||
/** Gets the record field named `name`, if any. */
|
||||
pragma[nomagic]
|
||||
StructField getStructField(string name) {
|
||||
result = this.getFieldList().(RecordFieldList).getAField() and
|
||||
result = this.getFieldList().(StructFieldList).getAField() and
|
||||
result.getName().getText() = name
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class StreamCipherInit extends Cryptography::CryptographicOperation::Range {
|
||||
.(PathTypeRepr)
|
||||
.getPath()
|
||||
.getSegment()
|
||||
.getNameRef()
|
||||
.getIdentifier()
|
||||
.getText()
|
||||
) and
|
||||
algorithmName = simplifyAlgorithmName(rawAlgorithmName)
|
||||
|
||||
@@ -9,7 +9,7 @@ final class CloneCallable extends SummarizedCallable::Range {
|
||||
// NOTE: The function target may not exist in the database, so we base this
|
||||
// on method calls.
|
||||
exists(MethodCallExpr c |
|
||||
c.getNameRef().getText() = "clone" and
|
||||
c.getIdentifier().getText() = "clone" and
|
||||
c.getArgList().getNumberOfArgs() = 0 and
|
||||
this = c.getResolvedCrateOrigin() + "::_::" + c.getResolvedPath()
|
||||
)
|
||||
|
||||
@@ -312,7 +312,7 @@ private class VariantItemNode extends ItemNode instanceof Variant {
|
||||
override string getName() { result = Variant.super.getName().getText() }
|
||||
|
||||
override Namespace getNamespace() {
|
||||
if super.getFieldList() instanceof RecordFieldList then result.isType() else result.isValue()
|
||||
if super.getFieldList() instanceof StructFieldList then result.isType() else result.isValue()
|
||||
}
|
||||
|
||||
override TypeParam getTypeParam(int i) {
|
||||
@@ -471,7 +471,7 @@ private class StructItemNode extends ItemNode instanceof Struct {
|
||||
override Namespace getNamespace() {
|
||||
result.isType() // the struct itself
|
||||
or
|
||||
not super.getFieldList() instanceof RecordFieldList and
|
||||
not super.getFieldList() instanceof StructFieldList and
|
||||
result.isValue() // the constructor
|
||||
}
|
||||
|
||||
|
||||
@@ -764,7 +764,7 @@ private module FieldExprMatchingInput implements MatchingInputSig {
|
||||
Type getTypeArgument(TypeArgumentPosition apos, TypePath path) { none() }
|
||||
|
||||
AstNode getNodeAt(AccessPosition apos) {
|
||||
result = this.getExpr() and
|
||||
result = this.getContainer() and
|
||||
apos.isSelf()
|
||||
or
|
||||
result = this and
|
||||
@@ -903,7 +903,7 @@ private module Cached {
|
||||
pragma[nomagic]
|
||||
private Type getMethodCallExprLookupType(MethodCallExpr mce, string name) {
|
||||
result = getLookupType(mce.getReceiver()) and
|
||||
name = mce.getNameRef().getText()
|
||||
name = mce.getIdentifier().getText()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -916,8 +916,8 @@ private module Cached {
|
||||
|
||||
pragma[nomagic]
|
||||
private Type getFieldExprLookupType(FieldExpr fe, string name) {
|
||||
result = getLookupType(fe.getExpr()) and
|
||||
name = fe.getNameRef().getText()
|
||||
result = getLookupType(fe.getContainer()) and
|
||||
name = fe.getIdentifier().getText()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,7 +64,7 @@ private class RegexInjectionDefaultBarrier extends RegexInjectionBarrier {
|
||||
.(PathExpr)
|
||||
.getPath()
|
||||
.getSegment()
|
||||
.getNameRef()
|
||||
.getIdentifier()
|
||||
.getText() = "escape"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user