@@ -3,9 +3,9 @@ module StringSet = Set.Make (String)
33let cmtCheckAnnotations ~checkAnnotation inputCMT =
44 match inputCMT.Cmt_format. cmt_annots with
55 | Implementation structure ->
6- structure |> Annotation. structureCheckAnnotation ~check Annotation
6+ structure |> Annotation. structureCheckAnnotation ~check Annotation
77 | Interface signature ->
8- signature |> Annotation. signatureCheckAnnotation ~check Annotation
8+ signature |> Annotation. signatureCheckAnnotation ~check Annotation
99 | _ -> false
1010
1111let cmtHasTypeErrors inputCMT =
@@ -25,61 +25,60 @@ let signatureItemIsDeclaration signatureItem =
2525
2626let inputCmtTranslateTypeDeclarations ~config ~outputFileRelative ~resolver
2727 inputCMT : CodeItem.translation =
28- let {Cmt_format. cmt_annots} = inputCMT in
28+ let { Cmt_format. cmt_annots } = inputCMT in
2929 let typeEnv = TypeEnv. root () in
3030 let translations =
3131 match cmt_annots with
3232 | 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
4040 | 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
4848 | Packed _ | Partial_implementation _ | Partial_interface _ -> []
4949 in
5050 translations |> Translation. combine
5151 |> Translation. addTypeDeclarationsFromModuleEquations ~type Env
5252
5353let translateCMT ~config ~outputFileRelative ~resolver inputCMT : Translation. t
5454 =
55- let {Cmt_format. cmt_annots} = inputCMT in
55+ let { Cmt_format. cmt_annots } = inputCMT in
5656 let typeEnv = TypeEnv. root () in
5757 let translations =
5858 match cmt_annots with
5959 | 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
6363 | 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
6767 | _ -> []
6868 in
6969 translations |> Translation. combine
7070 |> Translation. addTypeDeclarationsFromModuleEquations ~type Env
7171
7272let emitTranslation ~config ~fileName ~outputFile ~outputFileRelative ~resolver
73- ~signFile ~ sourceFile translation =
73+ ~sourceFile translation =
7474 let codeText =
7575 translation
7676 |> EmitJs. emitTranslationAsString ~config ~file Name ~output FileRelative
7777 ~resolver ~input CmtTranslateTypeDeclarations
7878 in
7979 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 "
8382 in
8483 GeneratedFiles. writeFileIfRequired ~output File ~file Contents
8584
@@ -94,7 +93,7 @@ let readCmt cmtFile =
9493 Log_. item " And try to clean and rebuild.\n\n " ;
9594 assert false
9695
97- let processCmtFile ~signFile ~ config cmt =
96+ let processCmtFile ~config cmt =
9897 let cmtFile = cmt |> Paths. getCmtFile in
9998 if cmtFile <> " " then
10099 let outputFile = cmt |> Paths. getOutputFile ~config in
@@ -103,7 +102,7 @@ let processCmtFile ~signFile ~config cmt =
103102 let isInterface = Filename. check_suffix cmtFile " .cmti" in
104103 let resolver =
105104 ModuleResolver. createLazyResolver ~config
106- ~extensions: [" .re" ; " .res" ; EmitType. shimExtension]
105+ ~extensions: [ " .re" ; " .res" ; EmitType. shimExtension ]
107106 ~exclude File:(fun fname ->
108107 fname = " React.re" || fname = " ReasonReact.re" )
109108 in
@@ -153,13 +152,13 @@ let processCmtFile ~signFile ~config cmt =
153152 match inputCMT.cmt_annots |> FindSourceFile. cmt with
154153 | Some sourceFile -> sourceFile
155154 | 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" )
158157 in
159158 inputCMT
160159 |> translateCMT ~config ~output FileRelative ~resolver
161160 |> emitTranslation ~config ~file Name ~output File ~output FileRelative
162- ~resolver ~sign File ~ source File
161+ ~resolver ~source File
163162 else if inputCMT |> cmtHasTypeErrors then
164163 outputFile |> GeneratedFiles. logFileAction TypeError
165164 else (
0 commit comments