Skip to content

Commit 1c82453

Browse files
authored
chore(ast-generic): Add Cls variant (#329)
- [X] I ran `make setup && make` to update the generated code after editing a `.atd` file (TODO: have a CI check) - [X] I made sure we're still backward compatible with old versions of the CLI. For example, the Semgrep backend need to still be able to *consume* data generated by Semgrep 1.50.0. See https://atd.readthedocs.io/en/latest/atdgen-tutorial.html#smooth-protocol-upgrades Note that the types related to the semgrep-core JSON output or the semgrep-core RPC do not need to be backward compatible!
1 parent f71d99f commit 1c82453

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

ast_generic_v1.atd

+1
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ type field_name = [
287287
type special = [
288288
(* special vars *)
289289
| This | Super (* called 'base' in C# *)
290+
| Cls (* similar to `self`, but indicating the type of the class, not the instance *)
290291
| Self | Parent (* different from This/Super? *)
291292

292293
(* special calls *)

ast_generic_v1_j.ml

+7
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,7 @@ let write_special = (
13611361
match x with
13621362
| `This -> Buffer.add_string ob "\"This\""
13631363
| `Super -> Buffer.add_string ob "\"Super\""
1364+
| `Cls -> Buffer.add_string ob "\"Cls\""
13641365
| `Self -> Buffer.add_string ob "\"Self\""
13651366
| `Parent -> Buffer.add_string ob "\"Parent\""
13661367
| `Eval -> Buffer.add_string ob "\"Eval\""
@@ -1435,6 +1436,10 @@ let read_special = (
14351436
Yojson.Safe.read_space p lb;
14361437
Yojson.Safe.read_gt p lb;
14371438
`Super
1439+
| "Cls" ->
1440+
Yojson.Safe.read_space p lb;
1441+
Yojson.Safe.read_gt p lb;
1442+
`Cls
14381443
| "Self" ->
14391444
Yojson.Safe.read_space p lb;
14401445
Yojson.Safe.read_gt p lb;
@@ -1578,6 +1583,8 @@ let read_special = (
15781583
`This
15791584
| "Super" ->
15801585
`Super
1586+
| "Cls" ->
1587+
`Cls
15811588
| "Self" ->
15821589
`Self
15831590
| "Parent" ->

0 commit comments

Comments
 (0)