mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
Swift: extract AppliedPropertyWrapperExpr
This commit is contained in:
@@ -573,4 +573,25 @@ ExprTranslator::translatePropertyWrapperValuePlaceholderExpr(
|
||||
return entry;
|
||||
}
|
||||
|
||||
static int translatePropertyWrapperValueKind(swift::AppliedPropertyWrapperExpr::ValueKind kind) {
|
||||
using K = swift::AppliedPropertyWrapperExpr::ValueKind;
|
||||
switch (kind) {
|
||||
case K::WrappedValue:
|
||||
return 1;
|
||||
case K::ProjectedValue:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
codeql::AppliedPropertyWrapperExpr ExprTranslator::translateAppliedPropertyWrapperExpr(
|
||||
const swift::AppliedPropertyWrapperExpr& expr) {
|
||||
auto entry = createExprEntry(expr);
|
||||
entry.kind = translatePropertyWrapperValueKind(expr.getValueKind());
|
||||
entry.value =
|
||||
dispatcher.fetchLabel(const_cast<swift::AppliedPropertyWrapperExpr&>(expr).getValue());
|
||||
entry.param = dispatcher.fetchLabel(expr.getParamDecl());
|
||||
return entry;
|
||||
}
|
||||
|
||||
} // namespace codeql
|
||||
|
||||
@@ -113,6 +113,8 @@ class ExprTranslator : public AstTranslatorBase<ExprTranslator> {
|
||||
const swift::UnresolvedSpecializeExpr& expr);
|
||||
codeql::PropertyWrapperValuePlaceholderExpr translatePropertyWrapperValuePlaceholderExpr(
|
||||
const swift::PropertyWrapperValuePlaceholderExpr& expr);
|
||||
codeql::AppliedPropertyWrapperExpr translateAppliedPropertyWrapperExpr(
|
||||
const swift::AppliedPropertyWrapperExpr& expr);
|
||||
|
||||
private:
|
||||
void fillAbstractClosureExpr(const swift::AbstractClosureExpr& expr,
|
||||
|
||||
Reference in New Issue
Block a user