Skip to content

Commit 9927a82

Browse files
authored
Merge pull request github#8789 from erik-krogh/apiIpaBranches
JS/PY: mention newtype constructors in API graph label classes
2 parents ff5b873 + aec8413 commit 9927a82

File tree

2 files changed

+17
-33
lines changed

2 files changed

+17
-33
lines changed

javascript/ql/lib/semmle/javascript/ApiGraphs.qll

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ module API {
13221322
MkLabelEntryPoint(API::EntryPoint e)
13231323

13241324
/** A label for an entry-point. */
1325-
class LabelEntryPoint extends ApiLabel {
1325+
class LabelEntryPoint extends ApiLabel, MkLabelEntryPoint {
13261326
API::EntryPoint e;
13271327

13281328
LabelEntryPoint() { this = MkLabelEntryPoint(e) }
@@ -1334,28 +1334,22 @@ module API {
13341334
}
13351335

13361336
/** A label that gets a promised value. */
1337-
class LabelPromised extends ApiLabel {
1338-
LabelPromised() { this = MkLabelPromised() }
1339-
1337+
class LabelPromised extends ApiLabel, MkLabelPromised {
13401338
override string toString() { result = "promised" }
13411339
}
13421340

13431341
/** A label that gets a rejected promise. */
1344-
class LabelPromisedError extends ApiLabel {
1345-
LabelPromisedError() { this = MkLabelPromisedError() }
1346-
1342+
class LabelPromisedError extends ApiLabel, MkLabelPromisedError {
13471343
override string toString() { result = "promisedError" }
13481344
}
13491345

13501346
/** A label that gets the return value of a function. */
1351-
class LabelReturn extends ApiLabel {
1352-
LabelReturn() { this = MkLabelReturn() }
1353-
1347+
class LabelReturn extends ApiLabel, MkLabelReturn {
13541348
override string toString() { result = "return" }
13551349
}
13561350

13571351
/** A label for a module. */
1358-
class LabelModule extends ApiLabel {
1352+
class LabelModule extends ApiLabel, MkLabelModule {
13591353
string mod;
13601354

13611355
LabelModule() { this = MkLabelModule(mod) }
@@ -1367,14 +1361,12 @@ module API {
13671361
}
13681362

13691363
/** A label that gets an instance from a `new` call. */
1370-
class LabelInstance extends ApiLabel {
1371-
LabelInstance() { this = MkLabelInstance() }
1372-
1364+
class LabelInstance extends ApiLabel, MkLabelInstance {
13731365
override string toString() { result = "instance" }
13741366
}
13751367

13761368
/** A label for the member named `prop`. */
1377-
class LabelMember extends ApiLabel {
1369+
class LabelMember extends ApiLabel, MkLabelMember {
13781370
string prop;
13791371

13801372
LabelMember() { this = MkLabelMember(prop) }
@@ -1386,14 +1378,14 @@ module API {
13861378
}
13871379

13881380
/** A label for a member with an unknown name. */
1389-
class LabelUnknownMember extends ApiLabel {
1381+
class LabelUnknownMember extends ApiLabel, MkLabelUnknownMember {
13901382
LabelUnknownMember() { this = MkLabelUnknownMember() }
13911383

13921384
override string toString() { result = "member *" }
13931385
}
13941386

13951387
/** A label for parameter `i`. */
1396-
class LabelParameter extends ApiLabel {
1388+
class LabelParameter extends ApiLabel, MkLabelParameter {
13971389
int i;
13981390

13991391
LabelParameter() { this = MkLabelParameter(i) }

python/ql/lib/semmle/python/ApiGraphs.qll

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ module API {
779779
MkLabelAwait()
780780

781781
/** A label for a module. */
782-
class LabelModule extends ApiLabel {
782+
class LabelModule extends ApiLabel, MkLabelModule {
783783
string mod;
784784

785785
LabelModule() { this = MkLabelModule(mod) }
@@ -791,7 +791,7 @@ module API {
791791
}
792792

793793
/** A label for the member named `prop`. */
794-
class LabelMember extends ApiLabel {
794+
class LabelMember extends ApiLabel, MkLabelMember {
795795
string member;
796796

797797
LabelMember() { this = MkLabelMember(member) }
@@ -803,14 +803,12 @@ module API {
803803
}
804804

805805
/** A label for a member with an unknown name. */
806-
class LabelUnknownMember extends ApiLabel {
807-
LabelUnknownMember() { this = MkLabelUnknownMember() }
808-
806+
class LabelUnknownMember extends ApiLabel, MkLabelUnknownMember {
809807
override string toString() { result = "getUnknownMember()" }
810808
}
811809

812810
/** A label for parameter `i`. */
813-
class LabelParameter extends ApiLabel {
811+
class LabelParameter extends ApiLabel, MkLabelParameter {
814812
int i;
815813

816814
LabelParameter() { this = MkLabelParameter(i) }
@@ -822,7 +820,7 @@ module API {
822820
}
823821

824822
/** A label for a keyword parameter `name`. */
825-
class LabelKeywordParameter extends ApiLabel {
823+
class LabelKeywordParameter extends ApiLabel, MkLabelKeywordParameter {
826824
string name;
827825

828826
LabelKeywordParameter() { this = MkLabelKeywordParameter(name) }
@@ -834,23 +832,17 @@ module API {
834832
}
835833

836834
/** A label that gets the return value of a function. */
837-
class LabelReturn extends ApiLabel {
838-
LabelReturn() { this = MkLabelReturn() }
839-
835+
class LabelReturn extends ApiLabel, MkLabelReturn {
840836
override string toString() { result = "getReturn()" }
841837
}
842838

843839
/** A label that gets the subclass of a class. */
844-
class LabelSubclass extends ApiLabel {
845-
LabelSubclass() { this = MkLabelSubclass() }
846-
840+
class LabelSubclass extends ApiLabel, MkLabelSubclass {
847841
override string toString() { result = "getASubclass()" }
848842
}
849843

850844
/** A label for awaited values. */
851-
class LabelAwait extends ApiLabel {
852-
LabelAwait() { this = MkLabelAwait() }
853-
845+
class LabelAwait extends ApiLabel, MkLabelAwait {
854846
override string toString() { result = "getAwaited()" }
855847
}
856848
}

0 commit comments

Comments
 (0)