Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ast-generic): Add Cls variant #329

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ast_generic_v1.atd
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ type field_name = [
type special = [
(* special vars *)
| This | Super (* called 'base' in C# *)
| Cls (* similar to `self`, but indicating the type of the class, not the instance *)
| Self | Parent (* different from This/Super? *)

(* special calls *)
Expand Down
7 changes: 7 additions & 0 deletions ast_generic_v1_j.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,7 @@ let write_special = (
match x with
| `This -> Buffer.add_string ob "\"This\""
| `Super -> Buffer.add_string ob "\"Super\""
| `Cls -> Buffer.add_string ob "\"Cls\""
| `Self -> Buffer.add_string ob "\"Self\""
| `Parent -> Buffer.add_string ob "\"Parent\""
| `Eval -> Buffer.add_string ob "\"Eval\""
Expand Down Expand Up @@ -1435,6 +1436,10 @@ let read_special = (
Yojson.Safe.read_space p lb;
Yojson.Safe.read_gt p lb;
`Super
| "Cls" ->
Yojson.Safe.read_space p lb;
Yojson.Safe.read_gt p lb;
`Cls
| "Self" ->
Yojson.Safe.read_space p lb;
Yojson.Safe.read_gt p lb;
Expand Down Expand Up @@ -1578,6 +1583,8 @@ let read_special = (
`This
| "Super" ->
`Super
| "Cls" ->
`Cls
| "Self" ->
`Self
| "Parent" ->
Expand Down
Loading