mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Swift: reorder generic type param children in nominal types
This commit is contained in:
@@ -72,8 +72,8 @@ ExtensionDecl:
|
|||||||
|
|
||||||
NominalTypeDecl:
|
NominalTypeDecl:
|
||||||
_extends:
|
_extends:
|
||||||
- IterableDeclContext
|
|
||||||
- GenericTypeDecl
|
- GenericTypeDecl
|
||||||
|
- IterableDeclContext
|
||||||
type: Type
|
type: Type
|
||||||
|
|
||||||
AstNode:
|
AstNode:
|
||||||
|
|||||||
@@ -4650,21 +4650,21 @@ private module Impl {
|
|||||||
private Element getImmediateChildOfNominalTypeDecl(
|
private Element getImmediateChildOfNominalTypeDecl(
|
||||||
NominalTypeDecl e, int index, string partialPredicateCall
|
NominalTypeDecl e, int index, string partialPredicateCall
|
||||||
) {
|
) {
|
||||||
exists(int b, int bIterableDeclContext, int bGenericTypeDecl, int n |
|
exists(int b, int bGenericTypeDecl, int bIterableDeclContext, int n |
|
||||||
b = 0 and
|
b = 0 and
|
||||||
bIterableDeclContext =
|
|
||||||
b + 1 + max(int i | i = -1 or exists(getImmediateChildOfIterableDeclContext(e, i, _)) | i) and
|
|
||||||
bGenericTypeDecl =
|
bGenericTypeDecl =
|
||||||
bIterableDeclContext + 1 +
|
b + 1 + max(int i | i = -1 or exists(getImmediateChildOfGenericTypeDecl(e, i, _)) | i) and
|
||||||
max(int i | i = -1 or exists(getImmediateChildOfGenericTypeDecl(e, i, _)) | i) and
|
bIterableDeclContext =
|
||||||
n = bGenericTypeDecl and
|
bGenericTypeDecl + 1 +
|
||||||
|
max(int i | i = -1 or exists(getImmediateChildOfIterableDeclContext(e, i, _)) | i) and
|
||||||
|
n = bIterableDeclContext and
|
||||||
(
|
(
|
||||||
none()
|
none()
|
||||||
or
|
or
|
||||||
result = getImmediateChildOfIterableDeclContext(e, index - b, partialPredicateCall)
|
result = getImmediateChildOfGenericTypeDecl(e, index - b, partialPredicateCall)
|
||||||
or
|
or
|
||||||
result =
|
result =
|
||||||
getImmediateChildOfGenericTypeDecl(e, index - bIterableDeclContext, partialPredicateCall)
|
getImmediateChildOfIterableDeclContext(e, index - bGenericTypeDecl, partialPredicateCall)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1480,7 +1480,7 @@ module Raw {
|
|||||||
string getStringValue() { integer_literal_exprs(this, result) }
|
string getStringValue() { integer_literal_exprs(this, result) }
|
||||||
}
|
}
|
||||||
|
|
||||||
class NominalTypeDecl extends @nominal_type_decl, IterableDeclContext, GenericTypeDecl {
|
class NominalTypeDecl extends @nominal_type_decl, GenericTypeDecl, IterableDeclContext {
|
||||||
Type getType() { nominal_type_decls(this, result) }
|
Type getType() { nominal_type_decls(this, result) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import codeql.swift.elements.decl.GenericTypeDecl
|
|||||||
import codeql.swift.elements.decl.IterableDeclContext
|
import codeql.swift.elements.decl.IterableDeclContext
|
||||||
import codeql.swift.elements.type.Type
|
import codeql.swift.elements.type.Type
|
||||||
|
|
||||||
class NominalTypeDeclBase extends Synth::TNominalTypeDecl, IterableDeclContext, GenericTypeDecl {
|
class NominalTypeDeclBase extends Synth::TNominalTypeDecl, GenericTypeDecl, IterableDeclContext {
|
||||||
Type getImmediateType() {
|
Type getImmediateType() {
|
||||||
result =
|
result =
|
||||||
Synth::convertTypeFromRaw(Synth::convertNominalTypeDeclToRaw(this)
|
Synth::convertTypeFromRaw(Synth::convertNominalTypeDeclToRaw(this)
|
||||||
|
|||||||
Reference in New Issue
Block a user