mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
Swift: implement extraction of new properties
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <swift/AST/GenericParamList.h>
|
||||
#include <swift/AST/ParameterList.h>
|
||||
#include "swift/extractor/infra/SwiftDiagnosticKind.h"
|
||||
#include "swift/AST/PropertyWrappers.h"
|
||||
|
||||
namespace codeql {
|
||||
namespace {
|
||||
@@ -85,6 +86,11 @@ std::optional<codeql::ParamDecl> DeclTranslator::translateParamDecl(const swift:
|
||||
}
|
||||
fillVarDecl(decl, *entry);
|
||||
entry->is_inout = decl.isInOut();
|
||||
if (auto wrapped = decl.getPropertyWrapperWrappedValueVar()) {
|
||||
entry->property_wrapper_local_wrapped_var = dispatcher.fetchLabel(wrapped);
|
||||
entry->property_wrapper_local_wrapped_var_binding =
|
||||
dispatcher.fetchLabel(wrapped->getParentPatternBinding());
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
@@ -355,6 +361,16 @@ void DeclTranslator::fillVarDecl(const swift::VarDecl& decl, codeql::VarDecl& en
|
||||
dispatcher.fetchOptionalLabel(decl.getPropertyWrapperBackingPropertyType());
|
||||
}
|
||||
fillAbstractStorageDecl(decl, entry);
|
||||
if (auto backing = decl.getPropertyWrapperBackingProperty()) {
|
||||
entry.property_wrapper_backing_var = dispatcher.fetchLabel(backing);
|
||||
entry.property_wrapper_backing_var_binding =
|
||||
dispatcher.fetchLabel(backing->getParentPatternBinding());
|
||||
}
|
||||
if (auto projection = decl.getPropertyWrapperProjectionVar()) {
|
||||
entry.property_wrapper_projection_var = dispatcher.fetchLabel(projection);
|
||||
entry.property_wrapper_projection_var_binding =
|
||||
dispatcher.fetchLabel(projection->getParentPatternBinding());
|
||||
}
|
||||
}
|
||||
|
||||
void DeclTranslator::fillNominalTypeDecl(const swift::NominalTypeDecl& decl,
|
||||
|
||||
@@ -3469,18 +3469,19 @@ declarations.swift:
|
||||
#-----| getElement(0): [ReturnStmt] return ...
|
||||
#-----| getResult(): [MemberRefExpr] .wrappedValue
|
||||
#-----| getBase(): [DeclRefExpr] _x
|
||||
#-----| getPropertyWrapperBackingVarBinding(): [PatternBindingDecl] var ... = ...
|
||||
# 77| getInit(0): [CallExpr] call to init()
|
||||
# 77| getFunction(): [ConstructorRefCallExpr] call to init()
|
||||
# 77| getFunction(): [DeclRefExpr] init()
|
||||
# 77| getArgument(0): [Argument] : ZeroWrapper.Type
|
||||
# 77| getExpr(): [TypeExpr] ZeroWrapper.Type
|
||||
# 77| getTypeRepr(): [TypeRepr] ZeroWrapper
|
||||
# 77| getPattern(0): [TypedPattern] ... as ...
|
||||
# 77| getSubPattern(): [NamedPattern] _x
|
||||
# 77| getPropertyWrapperBackingVar(): [ConcreteVarDecl] _x
|
||||
# 77| Type = ZeroWrapper
|
||||
# 78| getElement(2): [ReturnStmt] return ...
|
||||
# 78| getResult(): [DeclRefExpr] x
|
||||
# 77| [CallExpr] call to init()
|
||||
# 77| getFunction(): [ConstructorRefCallExpr] call to init()
|
||||
# 77| getFunction(): [DeclRefExpr] init()
|
||||
# 77| getArgument(0): [Argument] : ZeroWrapper.Type
|
||||
# 77| getExpr(): [TypeExpr] ZeroWrapper.Type
|
||||
# 77| getTypeRepr(): [TypeRepr] ZeroWrapper
|
||||
# 77| [TypedPattern] ... as ...
|
||||
# 77| getSubPattern(): [NamedPattern] _x
|
||||
# 77| [ConcreteVarDecl] _x
|
||||
# 77| Type = ZeroWrapper
|
||||
# 81| [StructDecl] HasPropertyAndObserver
|
||||
# 82| getMember(0): [PatternBindingDecl] var ... = ...
|
||||
# 82| getPattern(0): [TypedPattern] ... as ...
|
||||
|
||||
Reference in New Issue
Block a user