-
Notifications
You must be signed in to change notification settings - Fork 185
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
Add support for objects and classes #173
Conversation
fixes #13 |
Excellent, looking great! I couldn't check in great detail, but reading through the implementation I did not see anything concerning or notice any lurking gotchas. |
Certainly not perfect, not bug free, but I think I'm done the initial support. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic! Just a couple minor nits and questions.
src/Ast.ml
Outdated
@@ -202,10 +244,14 @@ end = struct | |||
|
|||
let sub_typ ~ctx typ = check parenze_typ {ctx; ast= typ} | |||
|
|||
let sub_cty ~ctx typ = {ctx; ast= typ} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: naming a class_type typ
is intended?
src/Ast.ml
Outdated
let sub_pat ~ctx pat = check parenze_pat {ctx; ast= pat} | ||
|
||
let sub_exp ~ctx exp = check parenze_exp {ctx; ast= exp} | ||
|
||
let sub_cl ~ctx typ = {ctx; ast= typ} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: naming a class_expr typ
is intended?
src/Ast.ml
Outdated
@@ -755,6 +1053,15 @@ end = struct | |||
| Some (Some true) -> true | |||
| _ -> false | |||
|
|||
(** [parenze_cty {ctx; ast}] holds when type [ast] should be parenthesized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/when type/when class type/ ?
src/Ast.ml
Outdated
@@ -989,6 +1325,15 @@ end = struct | |||
else exposed_right_exp Non_apply exp ) | |||
| _ -> false | |||
|
|||
(** [parenze_cl {ctx; ast}] holds when type [ast] should be parenthesized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/when type/when class expr/ ?
src/Fmt_ast.ml
Outdated
(Format.asprintf "%t" (Cmts.preserve (fun () -> fmt_expression c xe))) | ||
in | ||
let fmt_args_grouped e0 a1N = | ||
(* TODO: consider [e0] when groupping *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/groupping/grouping .
This is nontrivial due to the different types of e0 and a1N, right? Any other reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no other reason.
Thanks! |
This is an early preview. Feedback and contributions are welcome