mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Swift: fix KeyPathExpr assertion
This commit is contained in:
committed by
Paolo Tranquilli
parent
bcec7ee234
commit
1a654557a9
@@ -379,12 +379,7 @@ codeql::KeyPathExpr ExprTranslator::translateKeyPathExpr(const swift::KeyPathExp
|
||||
entry.components.push_back(emitKeyPathComponent(component));
|
||||
}
|
||||
if (auto rootTypeRepr = expr.getExplicitRootType()) {
|
||||
auto keyPathType = expr.getType()->getAs<swift::BoundGenericClassType>();
|
||||
CODEQL_EXPECT_OR(return entry, keyPathType, "KeyPathExpr must have BoundGenericClassType");
|
||||
auto keyPathTypeArgs = keyPathType->getGenericArgs();
|
||||
CODEQL_EXPECT_OR(return entry, keyPathTypeArgs.size() != 0,
|
||||
"KeyPathExpr type must have generic args");
|
||||
entry.root = dispatcher.fetchLabel(rootTypeRepr, keyPathTypeArgs[0]);
|
||||
entry.root = dispatcher.fetchLabel(rootTypeRepr, expr.getRootType());
|
||||
}
|
||||
}
|
||||
return entry;
|
||||
|
||||
Reference in New Issue
Block a user