@@ -3,9 +3,9 @@ module StringSet = Set.Make (String)
3
3
let cmtCheckAnnotations ~checkAnnotation inputCMT =
4
4
match inputCMT.Cmt_format. cmt_annots with
5
5
| Implementation structure ->
6
- structure |> Annotation. structureCheckAnnotation ~check Annotation
6
+ structure |> Annotation. structureCheckAnnotation ~check Annotation
7
7
| Interface signature ->
8
- signature |> Annotation. signatureCheckAnnotation ~check Annotation
8
+ signature |> Annotation. signatureCheckAnnotation ~check Annotation
9
9
| _ -> false
10
10
11
11
let cmtHasTypeErrors inputCMT =
@@ -25,61 +25,60 @@ let signatureItemIsDeclaration signatureItem =
25
25
26
26
let inputCmtTranslateTypeDeclarations ~config ~outputFileRelative ~resolver
27
27
inputCMT : CodeItem.translation =
28
- let {Cmt_format. cmt_annots} = inputCMT in
28
+ let { Cmt_format. cmt_annots } = inputCMT in
29
29
let typeEnv = TypeEnv. root () in
30
30
let translations =
31
31
match cmt_annots with
32
32
| Implementation structure ->
33
- {
34
- structure with
35
- str_items =
36
- structure.str_items |> List. filter structureItemIsDeclaration;
37
- }
38
- |> TranslateStructure. translateStructure ~config ~output FileRelative
39
- ~resolver ~type Env
33
+ {
34
+ structure with
35
+ str_items =
36
+ structure.str_items |> List. filter structureItemIsDeclaration;
37
+ }
38
+ |> TranslateStructure. translateStructure ~config ~output FileRelative
39
+ ~resolver ~type Env
40
40
| Interface signature ->
41
- {
42
- signature with
43
- sig_items =
44
- signature.sig_items |> List. filter signatureItemIsDeclaration;
45
- }
46
- |> TranslateSignature. translateSignature ~config ~output FileRelative
47
- ~resolver ~type Env
41
+ {
42
+ signature with
43
+ sig_items =
44
+ signature.sig_items |> List. filter signatureItemIsDeclaration;
45
+ }
46
+ |> TranslateSignature. translateSignature ~config ~output FileRelative
47
+ ~resolver ~type Env
48
48
| Packed _ | Partial_implementation _ | Partial_interface _ -> []
49
49
in
50
50
translations |> Translation. combine
51
51
|> Translation. addTypeDeclarationsFromModuleEquations ~type Env
52
52
53
53
let translateCMT ~config ~outputFileRelative ~resolver inputCMT : Translation. t
54
54
=
55
- let {Cmt_format. cmt_annots} = inputCMT in
55
+ let { Cmt_format. cmt_annots } = inputCMT in
56
56
let typeEnv = TypeEnv. root () in
57
57
let translations =
58
58
match cmt_annots with
59
59
| Implementation structure ->
60
- structure
61
- |> TranslateStructure. translateStructure ~config ~output FileRelative
62
- ~resolver ~type Env
60
+ structure
61
+ |> TranslateStructure. translateStructure ~config ~output FileRelative
62
+ ~resolver ~type Env
63
63
| Interface signature ->
64
- signature
65
- |> TranslateSignature. translateSignature ~config ~output FileRelative
66
- ~resolver ~type Env
64
+ signature
65
+ |> TranslateSignature. translateSignature ~config ~output FileRelative
66
+ ~resolver ~type Env
67
67
| _ -> []
68
68
in
69
69
translations |> Translation. combine
70
70
|> Translation. addTypeDeclarationsFromModuleEquations ~type Env
71
71
72
72
let emitTranslation ~config ~fileName ~outputFile ~outputFileRelative ~resolver
73
- ~signFile ~ sourceFile translation =
73
+ ~sourceFile translation =
74
74
let codeText =
75
75
translation
76
76
|> EmitJs. emitTranslationAsString ~config ~file Name ~output FileRelative
77
77
~resolver ~input CmtTranslateTypeDeclarations
78
78
in
79
79
let fileContents =
80
- signFile
81
- (EmitType. fileHeader ~source File:(Filename. basename sourceFile)
82
- ^ " \n " ^ codeText ^ " \n " )
80
+ EmitType. fileHeader ~source File:(Filename. basename sourceFile)
81
+ ^ " \n " ^ codeText ^ " \n "
83
82
in
84
83
GeneratedFiles. writeFileIfRequired ~output File ~file Contents
85
84
@@ -94,7 +93,7 @@ let readCmt cmtFile =
94
93
Log_. item " And try to clean and rebuild.\n\n " ;
95
94
assert false
96
95
97
- let processCmtFile ~signFile ~ config cmt =
96
+ let processCmtFile ~config cmt =
98
97
let cmtFile = cmt |> Paths. getCmtFile in
99
98
if cmtFile <> " " then
100
99
let outputFile = cmt |> Paths. getOutputFile ~config in
@@ -103,7 +102,7 @@ let processCmtFile ~signFile ~config cmt =
103
102
let isInterface = Filename. check_suffix cmtFile " .cmti" in
104
103
let resolver =
105
104
ModuleResolver. createLazyResolver ~config
106
- ~extensions: [" .re" ; " .res" ; EmitType. shimExtension]
105
+ ~extensions: [ " .re" ; " .res" ; EmitType. shimExtension ]
107
106
~exclude File:(fun fname ->
108
107
fname = " React.re" || fname = " ReasonReact.re" )
109
108
in
@@ -153,13 +152,13 @@ let processCmtFile ~signFile ~config cmt =
153
152
match inputCMT.cmt_annots |> FindSourceFile. cmt with
154
153
| Some sourceFile -> sourceFile
155
154
| None -> (
156
- (fileName |> ModuleName. toString)
157
- ^ match isInterface with true -> " .resi" | false -> " .res" )
155
+ (fileName |> ModuleName. toString)
156
+ ^ match isInterface with true -> " .resi" | false -> " .res" )
158
157
in
159
158
inputCMT
160
159
|> translateCMT ~config ~output FileRelative ~resolver
161
160
|> emitTranslation ~config ~file Name ~output File ~output FileRelative
162
- ~resolver ~sign File ~ source File
161
+ ~resolver ~source File
163
162
else if inputCMT |> cmtHasTypeErrors then
164
163
outputFile |> GeneratedFiles. logFileAction TypeError
165
164
else (
0 commit comments