Skip to content

Commit ce1c4b8

Browse files
committed
Swift: rename Function hierarchy in schema.py
1 parent 3c1456b commit ce1c4b8

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

swift/schema.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class ValueDecl(Decl):
141141
interface_type: Type
142142

143143
class AbstractStorageDecl(ValueDecl):
144-
accessor_decls: list["AccessorDecl"] | child
144+
accessors: list["Accessor"] | child
145145

146146
class VarDecl(AbstractStorageDecl):
147147
"""
@@ -234,7 +234,8 @@ class Callable(Element):
234234
body: optional["BraceStmt"] | child | desc("The body is absent within protocol declarations.")
235235
captures: list["CapturedDecl"] | child
236236

237-
class AbstractFunctionDecl(GenericContext, ValueDecl, Callable):
237+
@group("decl")
238+
class Function(GenericContext, ValueDecl, Callable):
238239
pass
239240

240241
class EnumElementDecl(ValueDecl):
@@ -257,13 +258,17 @@ class TypeDecl(ValueDecl):
257258
class AbstractTypeParamDecl(TypeDecl):
258259
pass
259260

260-
class ConstructorDecl(AbstractFunctionDecl):
261+
@group("decl")
262+
class Initializer(Function):
261263
pass
262264

263-
class DestructorDecl(AbstractFunctionDecl):
265+
@group("decl")
266+
class Deinitializer(Function):
264267
pass
265268

266-
class FuncDecl(AbstractFunctionDecl):
269+
@ql.internal
270+
@group("decl")
271+
class AccessorOrNamedFunction(Function):
267272
pass
268273

269274
class GenericTypeDecl(GenericContext, TypeDecl):
@@ -280,7 +285,8 @@ class SubscriptDecl(AbstractStorageDecl, GenericContext):
280285
element_type: Type
281286
element_type: Type
282287

283-
class AccessorDecl(FuncDecl):
288+
@group("decl")
289+
class Accessor(AccessorOrNamedFunction):
284290
is_getter: predicate | doc('this accessor is a getter')
285291
is_setter: predicate | doc('this accessor is a setter')
286292
is_will_set: predicate | doc('this accessor is a `willSet`, called before the property is set')
@@ -293,7 +299,8 @@ class AccessorDecl(FuncDecl):
293299
class AssociatedTypeDecl(AbstractTypeParamDecl):
294300
pass
295301

296-
class ConcreteFuncDecl(FuncDecl):
302+
@group("decl")
303+
class NamedFunction(AccessorOrNamedFunction):
297304
pass
298305

299306
class ConcreteVarDecl(VarDecl):
@@ -354,7 +361,7 @@ class Argument(Locatable):
354361
label: string
355362
expr: Expr | child
356363

357-
class AbstractClosureExpr(Expr, Callable):
364+
class ClosureExpr(Expr, Callable):
358365
pass
359366

360367
class AnyTryExpr(Expr):
@@ -384,7 +391,7 @@ class CapturedDecl(Decl):
384391

385392
class CaptureListExpr(Expr):
386393
binding_decls: list[PatternBindingDecl] | child
387-
closure_body: "ClosureExpr" | child
394+
closure_body: "ExplicitClosureExpr" | child
388395

389396
class CollectionExpr(Expr):
390397
pass
@@ -482,7 +489,7 @@ class KeyPathExpr(Expr):
482489
root: optional["TypeRepr"] | child
483490
components: list[KeyPathComponent] | child
484491

485-
class LazyInitializerExpr(Expr):
492+
class LazyInitializationExpr(Expr):
486493
sub_expr: Expr | child
487494

488495
class LiteralExpr(Expr):
@@ -500,7 +507,7 @@ class MakeTemporarilyEscapableExpr(Expr):
500507
@qltest.skip
501508
class ObjCSelectorExpr(Expr):
502509
sub_expr: Expr | child
503-
method: AbstractFunctionDecl
510+
method: Function
504511

505512
class OneWayExpr(Expr):
506513
sub_expr: Expr | child
@@ -516,8 +523,8 @@ class OpenExistentialExpr(Expr):
516523
class OptionalEvaluationExpr(Expr):
517524
sub_expr: Expr | child
518525

519-
class OtherConstructorDeclRefExpr(Expr):
520-
constructor_decl: ConstructorDecl
526+
class OtherInitializerRefExpr(Expr):
527+
initializer: Initializer
521528

522529
class PropertyWrapperValuePlaceholderExpr(Expr):
523530
"""
@@ -527,7 +534,7 @@ class PropertyWrapperValuePlaceholderExpr(Expr):
527534
wrapped_value: optional[Expr]
528535
placeholder: OpaqueValueExpr
529536

530-
class RebindSelfInConstructorExpr(Expr):
537+
class RebindSelfInInitializerExpr(Expr):
531538
sub_expr: Expr | child
532539
self: VarDecl
533540

@@ -579,7 +586,7 @@ class ArrayExpr(CollectionExpr):
579586
class ArrayToPointerExpr(ImplicitConversionExpr):
580587
pass
581588

582-
class AutoClosureExpr(AbstractClosureExpr):
589+
class AutoClosureExpr(ClosureExpr):
583590
pass
584591

585592
class AwaitExpr(IdentityExpr):
@@ -608,7 +615,7 @@ class CheckedCastExpr(ExplicitCastExpr):
608615
class ClassMetatypeToObjectExpr(ImplicitConversionExpr):
609616
pass
610617

611-
class ClosureExpr(AbstractClosureExpr):
618+
class ExplicitClosureExpr(ClosureExpr):
612619
pass
613620

614621
class CoerceExpr(ExplicitCastExpr):
@@ -776,9 +783,11 @@ class BooleanLiteralExpr(BuiltinLiteralExpr):
776783
class ConditionalCheckedCastExpr(CheckedCastExpr):
777784
pass
778785

779-
class ConstructorRefCallExpr(SelfApplyExpr):
786+
@ql.internal
787+
class InitializerRefCallExpr(SelfApplyExpr):
780788
pass
781789

790+
@ql.internal
782791
class DotSyntaxCallExpr(SelfApplyExpr):
783792
pass
784793

0 commit comments

Comments
 (0)