-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathRaw.qll
More file actions
7303 lines (6411 loc) · 196 KB
/
Raw.qll
File metadata and controls
7303 lines (6411 loc) · 196 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* INTERNAL: Do not use.
* This module holds thin fully generated class definitions around DB entities.
*/
module Raw {
/**
* INTERNAL: Do not use.
*/
class Element extends @element {
string toString() { none() }
/**
* Holds if this element is unknown.
*/
predicate isUnknown() { element_is_unknown(this) }
}
/**
* INTERNAL: Do not use.
*/
class File extends @file, Element {
/**
* Gets the name of this file.
*/
string getName() { files(this, result) }
/**
* Holds if this file is successfully extracted.
*/
predicate isSuccessfullyExtracted() { file_is_successfully_extracted(this) }
}
/**
* INTERNAL: Do not use.
*/
class Locatable extends @locatable, Element {
/**
* Gets the location associated with this element in the code, if it exists.
*/
Location getLocation() { locatable_locations(this, result) }
}
/**
* INTERNAL: Do not use.
*/
class Location extends @location, Element {
/**
* Gets the file of this location.
*/
File getFile() { locations(this, result, _, _, _, _) }
/**
* Gets the start line of this location.
*/
int getStartLine() { locations(this, _, result, _, _, _) }
/**
* Gets the start column of this location.
*/
int getStartColumn() { locations(this, _, _, result, _, _) }
/**
* Gets the end line of this location.
*/
int getEndLine() { locations(this, _, _, _, result, _) }
/**
* Gets the end column of this location.
*/
int getEndColumn() { locations(this, _, _, _, _, result) }
}
/**
* INTERNAL: Do not use.
*/
class AstNode extends @ast_node, Locatable { }
/**
* INTERNAL: Do not use.
*/
class Comment extends @comment, Locatable {
override string toString() { result = "Comment" }
/**
* Gets the text of this comment.
*/
string getText() { comments(this, result) }
}
private Element getImmediateChildOfComment(Comment e, int index) { none() }
/**
* INTERNAL: Do not use.
*/
class DbFile extends @db_file, File {
override string toString() { result = "DbFile" }
}
private Element getImmediateChildOfDbFile(DbFile e, int index) { none() }
/**
* INTERNAL: Do not use.
*/
class DbLocation extends @db_location, Location {
override string toString() { result = "DbLocation" }
}
private Element getImmediateChildOfDbLocation(DbLocation e, int index) { none() }
/**
* INTERNAL: Do not use.
*/
class Diagnostics extends @diagnostics, Locatable {
override string toString() { result = "Diagnostics" }
/**
* Gets the text of this diagnostics.
*/
string getText() { diagnostics(this, result, _) }
/**
* Gets the kind of this diagnostics.
*/
int getKind() { diagnostics(this, _, result) }
}
private Element getImmediateChildOfDiagnostics(Diagnostics e, int index) { none() }
/**
* INTERNAL: Do not use.
* The superclass of all elements indicating some kind of error.
*/
class ErrorElement extends @error_element, Locatable { }
/**
* INTERNAL: Do not use.
* An availability condition of an `if`, `while`, or `guard` statements.
*
* Examples:
* ```
* if #available(iOS 12, *) {
* // Runs on iOS 12 and above
* } else {
* // Runs only anything below iOS 12
* }
* if #unavailable(macOS 10.14, *) {
* // Runs only on macOS 10 and below
* }
* ```
*/
class AvailabilityInfo extends @availability_info, AstNode {
override string toString() { result = "AvailabilityInfo" }
/**
* Holds if it is #unavailable as opposed to #available.
*/
predicate isUnavailable() { availability_info_is_unavailable(this) }
/**
* Gets the `index`th spec of this availability info (0-based).
*/
AvailabilitySpec getSpec(int index) { availability_info_specs(this, index, result) }
/**
* Gets the number of specs of this availability info.
*/
int getNumberOfSpecs() { result = count(int i | availability_info_specs(this, i, _)) }
}
private Element getImmediateChildOfAvailabilityInfo(AvailabilityInfo e, int index) {
exists(int n, int nSpec |
n = 0 and
nSpec = n + e.getNumberOfSpecs() and
(
none()
or
result = e.getSpec(index - n)
)
)
}
/**
* INTERNAL: Do not use.
* An availability spec, that is, part of an `AvailabilityInfo` condition. For example `iOS 12` and `*` in:
* ```
* if #available(iOS 12, *)
* ```
*/
class AvailabilitySpec extends @availability_spec, AstNode {
override string toString() { result = "AvailabilitySpec" }
/**
* Gets the platform of this availability spec, if it exists.
*/
string getPlatform() { availability_spec_platforms(this, result) }
/**
* Gets the version of this availability spec, if it exists.
*/
string getVersion() { availability_spec_versions(this, result) }
/**
* Holds if this availability spec is wildcard.
*/
predicate isWildcard() { availability_spec_is_wildcard(this) }
}
private Element getImmediateChildOfAvailabilitySpec(AvailabilitySpec e, int index) { none() }
/**
* INTERNAL: Do not use.
*/
class Callable extends @callable, AstNode {
/**
* Gets the name of this callable, if it exists.
*
* The name includes argument labels of the callable, for example `myFunction(arg:)`.
*/
string getName() { callable_names(this, result) }
/**
* Gets the self parameter of this callable, if it exists.
*/
ParamDecl getSelfParam() { callable_self_params(this, result) }
/**
* Gets the `index`th parameter of this callable (0-based).
*/
ParamDecl getParam(int index) { callable_params(this, index, result) }
/**
* Gets the number of parameters of this callable.
*/
int getNumberOfParams() { result = count(int i | callable_params(this, i, _)) }
/**
* Gets the body of this callable, if it exists.
*
* The body is absent within protocol declarations.
*/
BraceStmt getBody() { callable_bodies(this, result) }
/**
* Gets the `index`th capture of this callable (0-based).
*/
CapturedDecl getCapture(int index) { callable_captures(this, index, result) }
/**
* Gets the number of captures of this callable.
*/
int getNumberOfCaptures() { result = count(int i | callable_captures(this, i, _)) }
}
/**
* INTERNAL: Do not use.
* A component of a `KeyPathExpr`.
*/
class KeyPathComponent extends @key_path_component, AstNode {
override string toString() { result = "KeyPathComponent" }
/**
* Gets the kind of key path component.
*
* INTERNAL: Do not use.
*
* This is 4 for method or initializer application, 5 for members, 6 for array and dictionary
* subscripts, 7 for optional forcing (`!`), 8 for optional chaining (`?`), 9 for implicit
* optional wrapping, 10 for `self`, and 11 for tuple element indexing.
*
* The following values should not appear: 0 for invalid components, 1 for unresolved
* method or initializer applications, 2 for unresolved members, 3 for unresolved subscripts,
* 12 for #keyPath dictionary keys, and 13 for implicit IDE code completion data.
*/
int getKind() { key_path_components(this, result, _) }
/**
* Gets the `index`th argument to an array or dictionary subscript expression (0-based).
*/
Argument getSubscriptArgument(int index) {
key_path_component_subscript_arguments(this, index, result)
}
/**
* Gets the number of arguments to an array or dictionary subscript expression.
*/
int getNumberOfSubscriptArguments() {
result = count(int i | key_path_component_subscript_arguments(this, i, _))
}
/**
* Gets the tuple index of this key path component, if it exists.
*/
int getTupleIndex() { key_path_component_tuple_indices(this, result) }
/**
* Gets the property or subscript operator, if it exists.
*/
ValueDecl getDeclRef() { key_path_component_decl_refs(this, result) }
/**
* Gets the return type of this component application.
*
* An optional-chaining component has a non-optional type to feed into the rest of the key
* path; an optional-wrapping component is inserted if required to produce an optional type
* as the final output.
*/
Type getComponentType() { key_path_components(this, _, result) }
}
private Element getImmediateChildOfKeyPathComponent(KeyPathComponent e, int index) {
exists(int n, int nSubscriptArgument |
n = 0 and
nSubscriptArgument = n + e.getNumberOfSubscriptArguments() and
(
none()
or
result = e.getSubscriptArgument(index - n)
)
)
}
/**
* INTERNAL: Do not use.
* The role of a macro, for example #freestanding(declaration) or @attached(member).
*/
class MacroRole extends @macro_role, AstNode {
override string toString() { result = "MacroRole" }
/**
* Gets the kind of this macro role (declaration, expression, member, etc.).
*/
int getKind() { macro_roles(this, result, _) }
/**
* Gets the #freestanding or @attached.
*/
int getMacroSyntax() { macro_roles(this, _, result) }
/**
* Gets the `index`th conformance of this macro role (0-based).
*/
Expr getConformance(int index) { macro_role_conformances(this, index, result) }
/**
* Gets the number of conformances of this macro role.
*/
int getNumberOfConformances() { result = count(int i | macro_role_conformances(this, i, _)) }
/**
* Gets the `index`th name of this macro role (0-based).
*/
string getName(int index) { macro_role_names(this, index, result) }
/**
* Gets the number of names of this macro role.
*/
int getNumberOfNames() { result = count(int i | macro_role_names(this, i, _)) }
}
private Element getImmediateChildOfMacroRole(MacroRole e, int index) { none() }
/**
* INTERNAL: Do not use.
*/
class UnspecifiedElement extends @unspecified_element, ErrorElement {
override string toString() { result = "UnspecifiedElement" }
/**
* Gets the parent of this unspecified element, if it exists.
*/
Element getParent() { unspecified_element_parents(this, result) }
/**
* Gets the property of this unspecified element.
*/
string getProperty() { unspecified_elements(this, result, _) }
/**
* Gets the index of this unspecified element, if it exists.
*/
int getIndex() { unspecified_element_indices(this, result) }
/**
* Gets the error of this unspecified element.
*/
string getError() { unspecified_elements(this, _, result) }
/**
* Gets the `index`th child of this unspecified element (0-based).
*
* These will be present only in certain downgraded databases.
*/
AstNode getChild(int index) { unspecified_element_children(this, index, result) }
/**
* Gets the number of children of this unspecified element.
*/
int getNumberOfChildren() { result = count(int i | unspecified_element_children(this, i, _)) }
}
private Element getImmediateChildOfUnspecifiedElement(UnspecifiedElement e, int index) {
exists(int n, int nChild |
n = 0 and
nChild = n + e.getNumberOfChildren() and
(
none()
or
result = e.getChild(index - n)
)
)
}
/**
* INTERNAL: Do not use.
*/
class Decl extends @decl, AstNode {
/**
* Gets the module of this declaration.
*/
ModuleDecl getModule() { decls(this, result) }
/**
* Gets the `index`th member of this declaration (0-based).
*
* Prefer to use more specific methods (such as `EnumDecl.getEnumElement`) rather than relying
* on the order of members given by `getMember`. In some cases the order of members may not
* align with expectations, and could change in future releases.
*/
Decl getMember(int index) { decl_members(this, index, result) }
/**
* Gets the number of members of this declaration.
*/
int getNumberOfMembers() { result = count(int i | decl_members(this, i, _)) }
}
/**
* INTERNAL: Do not use.
*/
class GenericContext extends @generic_context, Element {
/**
* Gets the `index`th generic type parameter of this generic context (0-based).
*/
GenericTypeParamDecl getGenericTypeParam(int index) {
generic_context_generic_type_params(this, index, result)
}
/**
* Gets the number of generic type parameters of this generic context.
*/
int getNumberOfGenericTypeParams() {
result = count(int i | generic_context_generic_type_params(this, i, _))
}
}
/**
* INTERNAL: Do not use.
*/
class CapturedDecl extends @captured_decl, Decl {
override string toString() { result = "CapturedDecl" }
/**
* Gets the the declaration captured by the parent closure.
*/
ValueDecl getDecl() { captured_decls(this, result) }
/**
* Holds if this captured declaration is direct.
*/
predicate isDirect() { captured_decl_is_direct(this) }
/**
* Holds if this captured declaration is escaping.
*/
predicate isEscaping() { captured_decl_is_escaping(this) }
}
private Element getImmediateChildOfCapturedDecl(CapturedDecl e, int index) {
exists(int n, int nMember |
n = 0 and
nMember = n + e.getNumberOfMembers() and
(
none()
or
result = e.getMember(index - n)
)
)
}
/**
* INTERNAL: Do not use.
*/
class EnumCaseDecl extends @enum_case_decl, Decl {
override string toString() { result = "EnumCaseDecl" }
/**
* Gets the `index`th element of this enum case declaration (0-based).
*/
EnumElementDecl getElement(int index) { enum_case_decl_elements(this, index, result) }
/**
* Gets the number of elements of this enum case declaration.
*/
int getNumberOfElements() { result = count(int i | enum_case_decl_elements(this, i, _)) }
}
private Element getImmediateChildOfEnumCaseDecl(EnumCaseDecl e, int index) {
exists(int n, int nMember |
n = 0 and
nMember = n + e.getNumberOfMembers() and
(
none()
or
result = e.getMember(index - n)
)
)
}
/**
* INTERNAL: Do not use.
*/
class ExtensionDecl extends @extension_decl, GenericContext, Decl {
override string toString() { result = "ExtensionDecl" }
/**
* Gets the extended type declaration of this extension declaration.
*/
NominalTypeDecl getExtendedTypeDecl() { extension_decls(this, result) }
/**
* Gets the `index`th protocol of this extension declaration (0-based).
*/
ProtocolDecl getProtocol(int index) { extension_decl_protocols(this, index, result) }
/**
* Gets the number of protocols of this extension declaration.
*/
int getNumberOfProtocols() { result = count(int i | extension_decl_protocols(this, i, _)) }
}
private Element getImmediateChildOfExtensionDecl(ExtensionDecl e, int index) {
exists(int n, int nGenericTypeParam, int nMember |
n = 0 and
nGenericTypeParam = n + e.getNumberOfGenericTypeParams() and
nMember = nGenericTypeParam + e.getNumberOfMembers() and
(
none()
or
result = e.getGenericTypeParam(index - n)
or
result = e.getMember(index - nGenericTypeParam)
)
)
}
/**
* INTERNAL: Do not use.
*/
class IfConfigDecl extends @if_config_decl, Decl {
override string toString() { result = "IfConfigDecl" }
/**
* Gets the `index`th active element of this if config declaration (0-based).
*/
AstNode getActiveElement(int index) { if_config_decl_active_elements(this, index, result) }
/**
* Gets the number of active elements of this if config declaration.
*/
int getNumberOfActiveElements() {
result = count(int i | if_config_decl_active_elements(this, i, _))
}
}
private Element getImmediateChildOfIfConfigDecl(IfConfigDecl e, int index) {
exists(int n, int nMember |
n = 0 and
nMember = n + e.getNumberOfMembers() and
(
none()
or
result = e.getMember(index - n)
)
)
}
/**
* INTERNAL: Do not use.
*/
class ImportDecl extends @import_decl, Decl {
override string toString() { result = "ImportDecl" }
/**
* Holds if this import declaration is exported.
*/
predicate isExported() { import_decl_is_exported(this) }
/**
* Gets the imported module of this import declaration, if it exists.
*/
ModuleDecl getImportedModule() { import_decl_imported_modules(this, result) }
/**
* Gets the `index`th declaration of this import declaration (0-based).
*/
ValueDecl getDeclaration(int index) { import_decl_declarations(this, index, result) }
/**
* Gets the number of declarations of this import declaration.
*/
int getNumberOfDeclarations() { result = count(int i | import_decl_declarations(this, i, _)) }
}
private Element getImmediateChildOfImportDecl(ImportDecl e, int index) {
exists(int n, int nMember |
n = 0 and
nMember = n + e.getNumberOfMembers() and
(
none()
or
result = e.getMember(index - n)
)
)
}
/**
* INTERNAL: Do not use.
* A placeholder for missing declarations that can arise on object deserialization.
*/
class MissingMemberDecl extends @missing_member_decl, Decl {
override string toString() { result = "MissingMemberDecl" }
/**
* Gets the name of this missing member declaration.
*/
string getName() { missing_member_decls(this, result) }
}
private Element getImmediateChildOfMissingMemberDecl(MissingMemberDecl e, int index) {
exists(int n, int nMember |
n = 0 and
nMember = n + e.getNumberOfMembers() and
(
none()
or
result = e.getMember(index - n)
)
)
}
/**
* INTERNAL: Do not use.
*/
class OperatorDecl extends @operator_decl, Decl {
/**
* Gets the name of this operator declaration.
*/
string getName() { operator_decls(this, result) }
}
/**
* INTERNAL: Do not use.
*/
class PatternBindingDecl extends @pattern_binding_decl, Decl {
override string toString() { result = "PatternBindingDecl" }
/**
* Gets the `index`th init of this pattern binding declaration (0-based), if it exists.
*/
Expr getInit(int index) { pattern_binding_decl_inits(this, index, result) }
/**
* Gets the number of inits of this pattern binding declaration.
*/
int getNumberOfInits() { result = count(int i | pattern_binding_decl_inits(this, i, _)) }
/**
* Gets the `index`th pattern of this pattern binding declaration (0-based).
*/
Pattern getPattern(int index) { pattern_binding_decl_patterns(this, index, result) }
/**
* Gets the number of patterns of this pattern binding declaration.
*/
int getNumberOfPatterns() { result = count(int i | pattern_binding_decl_patterns(this, i, _)) }
}
private Element getImmediateChildOfPatternBindingDecl(PatternBindingDecl e, int index) {
exists(int n, int nMember, int nInit, int nPattern |
n = 0 and
nMember = n + e.getNumberOfMembers() and
nInit = nMember + e.getNumberOfInits() and
nPattern = nInit + e.getNumberOfPatterns() and
(
none()
or
result = e.getMember(index - n)
or
result = e.getInit(index - nMember)
or
result = e.getPattern(index - nInit)
)
)
}
/**
* INTERNAL: Do not use.
* A diagnostic directive, which is either `#error` or `#warning`.
*/
class PoundDiagnosticDecl extends @pound_diagnostic_decl, Decl {
override string toString() { result = "PoundDiagnosticDecl" }
/**
* Gets the kind of this pound diagnostic declaration.
*
* This is 1 for `#error` and 2 for `#warning`.
*/
int getKind() { pound_diagnostic_decls(this, result, _) }
/**
* Gets the message of this pound diagnostic declaration.
*/
StringLiteralExpr getMessage() { pound_diagnostic_decls(this, _, result) }
}
private Element getImmediateChildOfPoundDiagnosticDecl(PoundDiagnosticDecl e, int index) {
exists(int n, int nMember, int nMessage |
n = 0 and
nMember = n + e.getNumberOfMembers() and
nMessage = nMember + 1 and
(
none()
or
result = e.getMember(index - n)
or
index = nMember and result = e.getMessage()
)
)
}
/**
* INTERNAL: Do not use.
*/
class PrecedenceGroupDecl extends @precedence_group_decl, Decl {
override string toString() { result = "PrecedenceGroupDecl" }
}
private Element getImmediateChildOfPrecedenceGroupDecl(PrecedenceGroupDecl e, int index) {
exists(int n, int nMember |
n = 0 and
nMember = n + e.getNumberOfMembers() and
(
none()
or
result = e.getMember(index - n)
)
)
}
/**
* INTERNAL: Do not use.
*/
class TopLevelCodeDecl extends @top_level_code_decl, Decl {
override string toString() { result = "TopLevelCodeDecl" }
/**
* Gets the body of this top level code declaration.
*/
BraceStmt getBody() { top_level_code_decls(this, result) }
}
private Element getImmediateChildOfTopLevelCodeDecl(TopLevelCodeDecl e, int index) {
exists(int n, int nMember, int nBody |
n = 0 and
nMember = n + e.getNumberOfMembers() and
nBody = nMember + 1 and
(
none()
or
result = e.getMember(index - n)
or
index = nMember and result = e.getBody()
)
)
}
/**
* INTERNAL: Do not use.
*/
class UsingDecl extends @using_decl, Decl {
override string toString() { result = "UsingDecl" }
/**
* Holds if this using declaration is main actor.
*/
predicate isMainActor() { using_decl_is_main_actor(this) }
/**
* Holds if this using declaration is nonisolated.
*/
predicate isNonisolated() { using_decl_is_nonisolated(this) }
}
private Element getImmediateChildOfUsingDecl(UsingDecl e, int index) {
exists(int n, int nMember |
n = 0 and
nMember = n + e.getNumberOfMembers() and
(
none()
or
result = e.getMember(index - n)
)
)
}
/**
* INTERNAL: Do not use.
*/
class ValueDecl extends @value_decl, Decl {
/**
* Gets the interface type of this value declaration.
*/
Type getInterfaceType() { value_decls(this, result) }
}
/**
* INTERNAL: Do not use.
*/
class AbstractStorageDecl extends @abstract_storage_decl, ValueDecl {
/**
* Gets the `index`th accessor of this abstract storage declaration (0-based).
*/
Accessor getAccessor(int index) { abstract_storage_decl_accessors(this, index, result) }
/**
* Gets the number of accessors of this abstract storage declaration.
*/
int getNumberOfAccessors() {
result = count(int i | abstract_storage_decl_accessors(this, i, _))
}
}
/**
* INTERNAL: Do not use.
*/
class EnumElementDecl extends @enum_element_decl, ValueDecl {
override string toString() { result = "EnumElementDecl" }
/**
* Gets the name of this enum element declaration.
*/
string getName() { enum_element_decls(this, result) }
/**
* Gets the `index`th parameter of this enum element declaration (0-based).
*/
ParamDecl getParam(int index) { enum_element_decl_params(this, index, result) }
/**
* Gets the number of parameters of this enum element declaration.
*/
int getNumberOfParams() { result = count(int i | enum_element_decl_params(this, i, _)) }
}
private Element getImmediateChildOfEnumElementDecl(EnumElementDecl e, int index) {
exists(int n, int nMember, int nParam |
n = 0 and
nMember = n + e.getNumberOfMembers() and
nParam = nMember + e.getNumberOfParams() and
(
none()
or
result = e.getMember(index - n)
or
result = e.getParam(index - nMember)
)
)
}
/**
* INTERNAL: Do not use.
*/
class Function extends @function, GenericContext, ValueDecl, Callable { }
/**
* INTERNAL: Do not use.
*/
class InfixOperatorDecl extends @infix_operator_decl, OperatorDecl {
override string toString() { result = "InfixOperatorDecl" }
/**
* Gets the precedence group of this infix operator declaration, if it exists.
*/
PrecedenceGroupDecl getPrecedenceGroup() { infix_operator_decl_precedence_groups(this, result) }
}
private Element getImmediateChildOfInfixOperatorDecl(InfixOperatorDecl e, int index) {
exists(int n, int nMember |
n = 0 and
nMember = n + e.getNumberOfMembers() and
(
none()
or
result = e.getMember(index - n)
)
)
}
/**
* INTERNAL: Do not use.
* A declaration of a macro. Some examples:
*
* ```
* @freestanding(declaration)
* macro A() = #externalMacro(module: "A", type: "A")
* @freestanding(expression)
* macro B() = Builtin.B
* @attached(member)
* macro C() = C.C
* ```
*/
class MacroDecl extends @macro_decl, GenericContext, ValueDecl {
override string toString() { result = "MacroDecl" }
/**
* Gets the name of this macro.
*/
string getName() { macro_decls(this, result) }
/**
* Gets the `index`th parameter of this macro (0-based).
*/
ParamDecl getParameter(int index) { macro_decl_parameters(this, index, result) }
/**
* Gets the number of parameters of this macro.
*/
int getNumberOfParameters() { result = count(int i | macro_decl_parameters(this, i, _)) }
/**
* Gets the `index`th role of this macro (0-based).
*/
MacroRole getRole(int index) { macro_decl_roles(this, index, result) }
/**
* Gets the number of roles of this macro.
*/
int getNumberOfRoles() { result = count(int i | macro_decl_roles(this, i, _)) }
}
private Element getImmediateChildOfMacroDecl(MacroDecl e, int index) {
exists(int n, int nGenericTypeParam, int nMember |
n = 0 and
nGenericTypeParam = n + e.getNumberOfGenericTypeParams() and
nMember = nGenericTypeParam + e.getNumberOfMembers() and
(
none()
or
result = e.getGenericTypeParam(index - n)
or
result = e.getMember(index - nGenericTypeParam)
)
)
}
/**
* INTERNAL: Do not use.
*/
class PostfixOperatorDecl extends @postfix_operator_decl, OperatorDecl {
override string toString() { result = "PostfixOperatorDecl" }
}
private Element getImmediateChildOfPostfixOperatorDecl(PostfixOperatorDecl e, int index) {
exists(int n, int nMember |
n = 0 and
nMember = n + e.getNumberOfMembers() and
(
none()
or
result = e.getMember(index - n)
)
)
}
/**
* INTERNAL: Do not use.
*/
class PrefixOperatorDecl extends @prefix_operator_decl, OperatorDecl {
override string toString() { result = "PrefixOperatorDecl" }
}
private Element getImmediateChildOfPrefixOperatorDecl(PrefixOperatorDecl e, int index) {
exists(int n, int nMember |
n = 0 and
nMember = n + e.getNumberOfMembers() and
(
none()
or
result = e.getMember(index - n)
)