Skip to content

Commit 6364bb5

Browse files
authored
Merge pull request #4979 from rescript-lang/support_rescript_synatx
upgrade rescript syntax
2 parents b4d5cae + 21d858f commit 6364bb5

File tree

6 files changed

+675
-953
lines changed

6 files changed

+675
-953
lines changed

jscomp/test/hello_res.res

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1+
@@config({
2+
flags : [
3+
"-dparsetree"
4+
]
5+
})
16

27
let b = List.length(list{1,2,3})
38
let a = b - 1
4-
Js.log ("hello, res")
9+
Js.log ("hello, res")
10+
11+
type t = { "x" : int }
12+
13+
14+
15+
let u : t = {"x" : 3 }
16+
17+
let h = u["x"]

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -406616,23 +406616,14 @@ let makePropsExternalSig fnName loc namedArgListWithKeyAndRef propsType =
406616406616
{ psig_loc = loc; psig_desc = Psig_value (makePropsValue fnName loc namedArgListWithKeyAndRef propsType) }
406617406617
[@@raises Invalid_argument]
406618406618

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

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

406624-
(* Build an AST node representing a "closed" Js.t object representing a component's props *)
406624+
(* Build an AST node representing a "closed" object representing a component's props *)
406625406625
let makePropsType ~loc namedTypeList =
406626-
Typ.mk ~loc
406627-
(Ptyp_constr
406628-
( { txt = Ldot (Lident "Js", "t"); loc },
406629-
[
406630-
{
406631-
ptyp_desc = Ptyp_object (List.map (makeObjectField loc) namedTypeList, Closed);
406632-
ptyp_loc = loc;
406633-
ptyp_attributes = [];
406634-
};
406635-
] ))
406626+
Typ.mk ~loc (Ptyp_object (List.map (makeObjectField loc) namedTypeList, Closed))
406636406627

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

0 commit comments

Comments
 (0)