Skip to content

upgrade rescript syntax #4979

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

Merged
merged 2 commits into from
Mar 1, 2021
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
15 changes: 14 additions & 1 deletion jscomp/test/hello_res.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
@@config({
flags : [
"-dparsetree"
]
})

let b = List.length(list{1,2,3})
let a = b - 1
Js.log ("hello, res")
Js.log ("hello, res")

type t = { "x" : int }



let u : t = {"x" : 3 }

let h = u["x"]
15 changes: 3 additions & 12 deletions lib/4.06.1/unstable/js_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -406616,23 +406616,14 @@ let makePropsExternalSig fnName loc namedArgListWithKeyAndRef propsType =
{ psig_loc = loc; psig_desc = Psig_value (makePropsValue fnName loc namedArgListWithKeyAndRef propsType) }
[@@raises Invalid_argument]

(* Build an AST node for the props name when converted to a Js.t inside the function signature *)
(* Build an AST node for the props name when converted to an object inside the function signature *)
let makePropsName ~loc name = { ppat_desc = Ppat_var { txt = name; loc }; ppat_loc = loc; ppat_attributes = [] }

let makeObjectField loc (str, attrs, type_) = Otag ({ loc; txt = str }, attrs, type_)

(* Build an AST node representing a "closed" Js.t object representing a component's props *)
(* Build an AST node representing a "closed" object representing a component's props *)
let makePropsType ~loc namedTypeList =
Typ.mk ~loc
(Ptyp_constr
( { txt = Ldot (Lident "Js", "t"); loc },
[
{
ptyp_desc = Ptyp_object (List.map (makeObjectField loc) namedTypeList, Closed);
ptyp_loc = loc;
ptyp_attributes = [];
};
] ))
Typ.mk ~loc (Ptyp_object (List.map (makeObjectField loc) namedTypeList, Closed))

(* Builds an AST node for the entire `external` definition of props *)
let makeExternalDecl fnName loc namedArgListWithKeyAndRef namedTypeList =
Expand Down
Loading