Swift: add generated docs for predicates

This commit is contained in:
Paolo Tranquilli
2022-10-20 11:05:01 +02:00
parent 22bd10132f
commit 37b405f134
16 changed files with 76 additions and 29 deletions

View File

@@ -41,6 +41,9 @@ module Generated {
result = getResolveStep().resolve()
}
/**
* Holds if this element is unknown.
*/
predicate isUnknown() { Synth::convertElementToRaw(this).isUnknown() }
}
}

View File

@@ -7,12 +7,24 @@ module Generated {
class AccessorDecl extends Synth::TAccessorDecl, FuncDecl {
override string getAPrimaryQlClass() { result = "AccessorDecl" }
/**
* Holds if this accessor is a getter.
*/
predicate isGetter() { Synth::convertAccessorDeclToRaw(this).(Raw::AccessorDecl).isGetter() }
/**
* Holds if this accessor is a setter.
*/
predicate isSetter() { Synth::convertAccessorDeclToRaw(this).(Raw::AccessorDecl).isSetter() }
/**
* Holds if this accessor is a `willSet`, called before the property is set.
*/
predicate isWillSet() { Synth::convertAccessorDeclToRaw(this).(Raw::AccessorDecl).isWillSet() }
/**
* Holds if this accessor is a `didSet`, called after the property is set.
*/
predicate isDidSet() { Synth::convertAccessorDeclToRaw(this).(Raw::AccessorDecl).isDidSet() }
}
}

View File

@@ -9,6 +9,9 @@ module Generated {
class ImportDecl extends Synth::TImportDecl, Decl {
override string getAPrimaryQlClass() { result = "ImportDecl" }
/**
* Holds if this import declaration is exported.
*/
predicate isExported() { Synth::convertImportDeclToRaw(this).(Raw::ImportDecl).isExported() }
/**

View File

@@ -7,10 +7,16 @@ module Generated {
class ModuleDecl extends Synth::TModuleDecl, TypeDecl {
override string getAPrimaryQlClass() { result = "ModuleDecl" }
/**
* Holds if this module is the built-in one.
*/
predicate isBuiltinModule() {
Synth::convertModuleDeclToRaw(this).(Raw::ModuleDecl).isBuiltinModule()
}
/**
* Holds if this module is a system one.
*/
predicate isSystemModule() {
Synth::convertModuleDeclToRaw(this).(Raw::ModuleDecl).isSystemModule()
}

View File

@@ -7,6 +7,9 @@ module Generated {
class ParamDecl extends Synth::TParamDecl, VarDecl {
override string getAPrimaryQlClass() { result = "ParamDecl" }
/**
* Holds if this is an `inout` parameter.
*/
predicate isInout() { Synth::convertParamDeclToRaw(this).(Raw::ParamDecl).isInout() }
}
}

View File

@@ -55,14 +55,23 @@ module Generated {
*/
final int getNumberOfReplacementTypes() { result = count(getAReplacementType()) }
/**
* Holds if this declaration ref expression has direct to storage semantics.
*/
predicate hasDirectToStorageSemantics() {
Synth::convertDeclRefExprToRaw(this).(Raw::DeclRefExpr).hasDirectToStorageSemantics()
}
/**
* Holds if this declaration ref expression has direct to implementation semantics.
*/
predicate hasDirectToImplementationSemantics() {
Synth::convertDeclRefExprToRaw(this).(Raw::DeclRefExpr).hasDirectToImplementationSemantics()
}
/**
* Holds if this declaration ref expression has ordinary semantics.
*/
predicate hasOrdinarySemantics() {
Synth::convertDeclRefExprToRaw(this).(Raw::DeclRefExpr).hasOrdinarySemantics()
}

View File

@@ -7,16 +7,25 @@ module Generated {
class MemberRefExpr extends Synth::TMemberRefExpr, LookupExpr {
override string getAPrimaryQlClass() { result = "MemberRefExpr" }
/**
* Holds if this member ref expression has direct to storage semantics.
*/
predicate hasDirectToStorageSemantics() {
Synth::convertMemberRefExprToRaw(this).(Raw::MemberRefExpr).hasDirectToStorageSemantics()
}
/**
* Holds if this member ref expression has direct to implementation semantics.
*/
predicate hasDirectToImplementationSemantics() {
Synth::convertMemberRefExprToRaw(this)
.(Raw::MemberRefExpr)
.hasDirectToImplementationSemantics()
}
/**
* Holds if this member ref expression has ordinary semantics.
*/
predicate hasOrdinarySemantics() {
Synth::convertMemberRefExprToRaw(this).(Raw::MemberRefExpr).hasOrdinarySemantics()
}

View File

@@ -36,16 +36,25 @@ module Generated {
*/
final int getNumberOfArguments() { result = count(getAnArgument()) }
/**
* Holds if this subscript expression has direct to storage semantics.
*/
predicate hasDirectToStorageSemantics() {
Synth::convertSubscriptExprToRaw(this).(Raw::SubscriptExpr).hasDirectToStorageSemantics()
}
/**
* Holds if this subscript expression has direct to implementation semantics.
*/
predicate hasDirectToImplementationSemantics() {
Synth::convertSubscriptExprToRaw(this)
.(Raw::SubscriptExpr)
.hasDirectToImplementationSemantics()
}
/**
* Holds if this subscript expression has ordinary semantics.
*/
predicate hasOrdinarySemantics() {
Synth::convertSubscriptExprToRaw(this).(Raw::SubscriptExpr).hasOrdinarySemantics()
}

View File

@@ -68,10 +68,16 @@ module Generated {
*/
final int getNumberOfParamLabels() { result = count(getAParamLabel()) }
/**
* Holds if this any function type is throwing.
*/
predicate isThrowing() {
Synth::convertAnyFunctionTypeToRaw(this).(Raw::AnyFunctionType).isThrowing()
}
/**
* Holds if this any function type is async.
*/
predicate isAsync() {
Synth::convertAnyFunctionTypeToRaw(this).(Raw::AnyFunctionType).isAsync()
}