File tree 5 files changed +22
-7
lines changed
5 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -896,7 +896,7 @@ module Settings = {
896
896
897
897
let open_modules = switch readyState .selected .apiVersion {
898
898
| V1 | V2 | V3 | UnknownVersion (_ ) => None
899
- | V4 =>
899
+ | V4 | V5 =>
900
900
readyState .selected .libraries -> Array .some (el => el === "@rescript/core" )
901
901
? Some (["RescriptCore" ])
902
902
: None
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ module Version = {
37
37
| V2
38
38
| V3
39
39
| V4
40
+ | V5
40
41
| UnknownVersion (string )
41
42
42
43
// Helps finding the right API version
@@ -59,6 +60,7 @@ module Version = {
59
60
| list {"2" } => V2
60
61
| list {"3" } => V3
61
62
| list {"4" } => V4
63
+ | list {"5" } => V5
62
64
| _ => UnknownVersion (apiVersion )
63
65
}
64
66
@@ -68,6 +70,7 @@ module Version = {
68
70
| V2 => "2.0"
69
71
| V3 => "3.0"
70
72
| V4 => "4.0"
73
+ | V5 => "5.0"
71
74
| UnknownVersion (version ) => version
72
75
}
73
76
@@ -76,7 +79,7 @@ module Version = {
76
79
let availableLanguages = t =>
77
80
switch t {
78
81
| V1 => [Lang .Reason , Res ]
79
- | V2 | V3 | V4 => [Lang .Res ]
82
+ | V2 | V3 | V4 | V5 => [Lang .Res ]
80
83
| UnknownVersion (_ ) => [Res ]
81
84
}
82
85
}
@@ -405,7 +408,13 @@ module Compiler = {
405
408
ConversionResult .decode (~fromLang = Reason , ~toLang = Reason , json )
406
409
}
407
410
408
- @get @scope ("ocaml" ) external ocamlVersion : t => string = "version"
411
+ @get external ocaml : t => option <{.. }> = "ocaml"
412
+ let ocamlVersion = (t : t ): option <string > => {
413
+ switch ocaml (t ) {
414
+ | Some (ocaml ) => ocaml -> Obj .magic -> Dict .get ("version" )
415
+ | None => None
416
+ }
417
+ }
409
418
410
419
@send @scope ("ocaml" )
411
420
external ocamlCompile : (t , string ) => JSON .t = "compile"
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ module Version: {
25
25
| V2
26
26
| V3
27
27
| V4
28
+ | V5
28
29
| UnknownVersion(string)
29
30
30
31
// Helps finding the right API version
@@ -188,7 +189,7 @@ module Compiler: {
188
189
/*
189
190
* OCaml compiler actions (Note: no pretty print available for OCaml)
190
191
*/
191
- let ocamlVersion: t => string
192
+ let ocamlVersion: t => option< string>
192
193
let ocamlCompile: (t, string) => CompilationResult.t
193
194
194
195
/*
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ let getLibrariesForVersion = (~version: Semver.t): array<string> => {
147
147
let getOpenModules = (~apiVersion : Version .t , ~libraries : array <string >): option <array <string >> =>
148
148
switch apiVersion {
149
149
| V1 | V2 | V3 | UnknownVersion (_ ) => None
150
- | V4 => libraries -> Array .some (el => el === "@rescript/core" ) ? Some (["RescriptCore" ]) : None
150
+ | V4 | V5 => libraries -> Array .some (el => el === "@rescript/core" ) ? Some (["RescriptCore" ]) : None
151
151
}
152
152
153
153
/*
@@ -207,7 +207,7 @@ type selected = {
207
207
id : Semver .t , // The id used for loading the compiler bundle (ideally should be the same as compilerVersion)
208
208
apiVersion : Version .t , // The playground API version in use
209
209
compilerVersion : string ,
210
- ocamlVersion : string ,
210
+ ocamlVersion : option < string > ,
211
211
libraries : array <string >,
212
212
config : Config .t ,
213
213
instance : Compiler .t ,
@@ -510,6 +510,11 @@ let useCompilerManager = (
510
510
)
511
511
| Lang .Res => instance -> Compiler .resCompile (code )
512
512
}
513
+ | V5 =>
514
+ switch lang {
515
+ | Lang .Res => instance -> Compiler .resCompile (code )
516
+ | _ => CompilationResult .UnexpectedError (` Can't handle with lang: ${lang-> Lang.toString}` )
517
+ }
513
518
| UnknownVersion (version ) =>
514
519
CompilationResult .UnexpectedError (
515
520
` Can't handle result of compiler API version "${version}"` ,
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ type selected = {
28
28
id: Semver.t, // The id used for loading the compiler bundle (ideally should be the same as compilerVersion)
29
29
apiVersion: Version.t, // The playground API version in use
30
30
compilerVersion: string,
31
- ocamlVersion: string,
31
+ ocamlVersion: option< string> ,
32
32
libraries: array<string>,
33
33
config: Config.t,
34
34
instance: Compiler.t,
You can’t perform that action at this time.
0 commit comments