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