-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathXform.res
67 lines (53 loc) · 1.03 KB
/
Xform.res
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
type kind = First | Second | Third
type r = {name: string, age: int}
let ret = _ => assert false
let kind = assert false
if kind == First {
// ^xfm
ret("First")
} else {
ret("Not First")
}
#kind("First", {name: "abc", age: 3}) != kind ? ret("Not First") : ret("First")
// ^xfm
let name = "hello"
// ^xfm
let annotated: int = 34
// ^xfm
module T = {
type r = {a: int, x: string}
}
let foo = x =>
// ^xfm
switch x {
| None => 33
| Some(q) => q.T.a + 1
// ^xfm
}
let withAs = (~x as name) => name + 1
// ^xfm
@react.component
let make = (~name) => React.string(name)
// ^xfm
let _ = (~x) => x + 1
// ^xfm
//
// Add braces to the body of a function
//
let noBraces = () => name
// ^xfm
let nested = () => {
let _noBraces = (_x, _y, _z) => "someNewFunc"
// ^xfm
}
let bar = () => {
module Inner = {
let foo = (_x, y, _z) =>
switch y {
| #some => 3
| #stuff => 4
}
//^xfm
}
Inner.foo(1)
}