mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Swift: fix static assert?
This commit is contained in:
@@ -89,7 +89,7 @@ Callable:
|
||||
body: BraceStmt?
|
||||
|
||||
ConditionElement:
|
||||
_extends: Locatable
|
||||
_extends: AstNode
|
||||
_children:
|
||||
boolean: Expr?
|
||||
pattern: Pattern?
|
||||
|
||||
@@ -3298,17 +3298,17 @@ private module Impl {
|
||||
private Element getImmediateChildOfConditionElement(
|
||||
ConditionElement e, int index, string partialPredicateCall
|
||||
) {
|
||||
exists(int b, int bLocatable, int n, int nBoolean, int nPattern, int nInitializer |
|
||||
exists(int b, int bAstNode, int n, int nBoolean, int nPattern, int nInitializer |
|
||||
b = 0 and
|
||||
bLocatable = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfLocatable(e, i, _)) | i) and
|
||||
n = bLocatable and
|
||||
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
|
||||
n = bAstNode and
|
||||
nBoolean = n + 1 and
|
||||
nPattern = nBoolean + 1 and
|
||||
nInitializer = nPattern + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
result = getImmediateChildOfLocatable(e, index - b, partialPredicateCall)
|
||||
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
|
||||
or
|
||||
index = n and result = e.getImmediateBoolean() and partialPredicateCall = "Boolean()"
|
||||
or
|
||||
|
||||
@@ -1030,7 +1030,7 @@ module Raw {
|
||||
Expr getGuard() { case_label_item_guards(this, result) }
|
||||
}
|
||||
|
||||
class ConditionElement extends @condition_element, Locatable {
|
||||
class ConditionElement extends @condition_element, AstNode {
|
||||
override string toString() { result = "ConditionElement" }
|
||||
|
||||
Expr getBoolean() { condition_element_booleans(this, result) }
|
||||
|
||||
@@ -314,13 +314,14 @@ module Synth {
|
||||
TWeakStorageType(Raw::WeakStorageType id) { constructWeakStorageType(id) }
|
||||
|
||||
class TAstNode =
|
||||
TCaseLabelItem or TDecl or TExpr or TPattern or TStmt or TStmtCondition or TTypeRepr;
|
||||
TCaseLabelItem or TConditionElement or TDecl or TExpr or TPattern or TStmt or TStmtCondition or
|
||||
TTypeRepr;
|
||||
|
||||
class TCallable = TAbstractClosureExpr or TAbstractFunctionDecl;
|
||||
|
||||
class TFile = TDbFile or TUnknownFile;
|
||||
|
||||
class TLocatable = TArgument or TAstNode or TComment or TConditionElement;
|
||||
class TLocatable = TArgument or TAstNode or TComment;
|
||||
|
||||
class TLocation = TDbLocation or TUnknownLocation;
|
||||
|
||||
@@ -1408,6 +1409,8 @@ module Synth {
|
||||
TAstNode convertAstNodeFromRaw(Raw::Element e) {
|
||||
result = convertCaseLabelItemFromRaw(e)
|
||||
or
|
||||
result = convertConditionElementFromRaw(e)
|
||||
or
|
||||
result = convertDeclFromRaw(e)
|
||||
or
|
||||
result = convertExprFromRaw(e)
|
||||
@@ -1461,8 +1464,6 @@ module Synth {
|
||||
result = convertAstNodeFromRaw(e)
|
||||
or
|
||||
result = convertCommentFromRaw(e)
|
||||
or
|
||||
result = convertConditionElementFromRaw(e)
|
||||
}
|
||||
|
||||
cached
|
||||
@@ -3106,6 +3107,8 @@ module Synth {
|
||||
Raw::Element convertAstNodeToRaw(TAstNode e) {
|
||||
result = convertCaseLabelItemToRaw(e)
|
||||
or
|
||||
result = convertConditionElementToRaw(e)
|
||||
or
|
||||
result = convertDeclToRaw(e)
|
||||
or
|
||||
result = convertExprToRaw(e)
|
||||
@@ -3159,8 +3162,6 @@ module Synth {
|
||||
result = convertAstNodeToRaw(e)
|
||||
or
|
||||
result = convertCommentToRaw(e)
|
||||
or
|
||||
result = convertConditionElementToRaw(e)
|
||||
}
|
||||
|
||||
cached
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// generated by codegen/codegen.py
|
||||
private import codeql.swift.generated.Synth
|
||||
private import codeql.swift.generated.Raw
|
||||
import codeql.swift.elements.AstNode
|
||||
import codeql.swift.elements.expr.Expr
|
||||
import codeql.swift.elements.Locatable
|
||||
import codeql.swift.elements.pattern.Pattern
|
||||
|
||||
class ConditionElementBase extends Synth::TConditionElement, Locatable {
|
||||
class ConditionElementBase extends Synth::TConditionElement, AstNode {
|
||||
override string getAPrimaryQlClass() { result = "ConditionElement" }
|
||||
|
||||
Expr getImmediateBoolean() {
|
||||
|
||||
@@ -66,7 +66,6 @@ files(
|
||||
@argument
|
||||
| @ast_node
|
||||
| @comment
|
||||
| @condition_element
|
||||
;
|
||||
|
||||
#keyset[id]
|
||||
@@ -103,6 +102,7 @@ locations(
|
||||
|
||||
@ast_node =
|
||||
@case_label_item
|
||||
| @condition_element
|
||||
| @decl
|
||||
| @expr
|
||||
| @pattern
|
||||
|
||||
Reference in New Issue
Block a user