File tree 2 files changed +85
-8
lines changed
jscomp/syntax/tests/printer/pattern
2 files changed +85
-8
lines changed Original file line number Diff line number Diff line change 1
1
let someDict = dict {
2
- "one" : "one" ,
2
+ "one" : "one" ,
3
3
}
4
4
5
5
let dict {"one" : ?one } = someDict
6
6
7
- let foo = () => switch someDict {
8
- | dict {"one" : "one" } => Js .log ("one" )
9
- | _ => Js .log ("not one" )
10
- }
7
+ let foo = () => {
8
+ let _ = switch someDict {
9
+ // Comment here
10
+ | dict {
11
+ // Comment above the pattern
12
+ "one" :
13
+ // Comment right in the pattern
14
+ "one" ,
15
+ } =>
16
+ Js .log ("one" )
17
+ | _ => Js .log ("not one" )
18
+ }
19
+
20
+ let _ = switch someDict {
21
+ | dict {
22
+ // foo
23
+ "one" : "one" ,
24
+ // bar
25
+ "twoooooooooo" : 2 ,
26
+ // baz
27
+ "three" : 3 ,
28
+ "fooooour" : 4 ,
29
+ "fiiiive" : 5 ,
30
+ } =>
31
+ Js .log ("one" )
32
+ | _ => Js .log ("not one" )
33
+ }
34
+
35
+ let _ = switch someDict {
36
+ | dict {
37
+ /* foo */
38
+ /* baz */ "one" : "one" ,
39
+ /* bar */
40
+ /* baz */ "twoooooooooo" : 2 ,
41
+ /* baz */
42
+ /* baz */ "three" : 3 ,
43
+ "fooooour" : 4 ,
44
+ "fiiiive" : 5 ,
45
+ } =>
46
+ Js .log ("one" )
47
+ | _ => Js .log ("not one" )
48
+ }
49
+ }
Original file line number Diff line number Diff line change @@ -4,8 +4,46 @@ let someDict = dict{
4
4
5
5
let dict{"one": ?one} = someDict
6
6
7
- let foo = () =>
8
- switch someDict {
9
- | dict{"one": "one"} => Js.log("one")
7
+ let foo = () => {
8
+ let _ = switch someDict {
9
+ // Comment here
10
+ | dict{
11
+ // Comment above the pattern
12
+ "one":
13
+ // Comment right in the pattern
14
+ "one",
15
+ } =>
16
+ Js.log("one")
10
17
| _ => Js.log("not one")
11
18
}
19
+
20
+ let _ = switch someDict {
21
+ | dict{
22
+ // foo
23
+ "one": "one",
24
+ // bar
25
+ "twoooooooooo": 2,
26
+ // baz
27
+ "three": 3,
28
+ "fooooour": 4,
29
+ "fiiiive": 5,
30
+ } =>
31
+ Js.log("one")
32
+ | _ => Js.log("not one")
33
+ }
34
+
35
+ let _ = switch someDict {
36
+ | dict{
37
+ /* foo */
38
+ /* baz */ "one": "one",
39
+ /* bar */
40
+ /* baz */ "twoooooooooo": 2,
41
+ /* baz */
42
+ /* baz */ "three": 3,
43
+ "fooooour": 4,
44
+ "fiiiive": 5,
45
+ } =>
46
+ Js.log("one")
47
+ | _ => Js.log("not one")
48
+ }
49
+ }
You can’t perform that action at this time.
0 commit comments