Skip to content

Commit 426860f

Browse files
committed
minor range update
1 parent fd3a482 commit 426860f

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

fcs/fcs-fable/test/Platform.fs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,39 @@ let getRelativePath (pathFrom: string) (pathTo: string) =
2424

2525
open Fable.Core.JsInterop
2626

27-
type private IFileSystem =
28-
abstract readFileSync: string -> byte[]
29-
abstract readFileSync: string * string -> string
30-
abstract writeFileSync: string * string -> unit
27+
module JS =
28+
type IFileSystem =
29+
abstract readFileSync: string -> byte[]
30+
abstract readFileSync: string * string -> string
31+
abstract writeFileSync: string * string -> unit
3132

32-
type private IProcess =
33-
abstract hrtime: unit -> float []
34-
abstract hrtime: float[] -> float[]
33+
type IProcess =
34+
abstract hrtime: unit -> float []
35+
abstract hrtime: float[] -> float[]
3536

36-
type private IPath =
37-
abstract resolve: string -> string
38-
abstract relative: string * string -> string
37+
type IPath =
38+
abstract resolve: string -> string
39+
abstract relative: string * string -> string
3940

40-
let private FileSystem: IFileSystem = importAll "fs"
41-
let private Process: IProcess = importAll "process"
42-
let private Path: IPath = importAll "path"
41+
let FileSystem: IFileSystem = importAll "fs"
42+
let Process: IProcess = importAll "process"
43+
let Path: IPath = importAll "path"
4344

44-
let readAllBytes (filePath: string) = FileSystem.readFileSync(filePath)
45-
let readAllText (filePath: string) = FileSystem.readFileSync(filePath, "utf8").TrimStart('\uFEFF')
46-
let writeAllText (filePath: string) (text: string) = FileSystem.writeFileSync(filePath, text)
45+
let readAllBytes (filePath: string) = JS.FileSystem.readFileSync(filePath)
46+
let readAllText (filePath: string) = JS.FileSystem.readFileSync(filePath, "utf8").TrimStart('\uFEFF')
47+
let writeAllText (filePath: string) (text: string) = JS.FileSystem.writeFileSync(filePath, text)
4748

4849
let measureTime (f: 'a -> 'b) x =
49-
let startTime = Process.hrtime()
50+
let startTime = JS.Process.hrtime()
5051
let res = f x
51-
let elapsed = Process.hrtime(startTime)
52+
let elapsed = JS.Process.hrtime(startTime)
5253
int64 (elapsed.[0] * 1e3 + elapsed.[1] / 1e6), res
5354

5455
let normalizeFullPath (path: string) =
55-
Path.resolve(path).Replace('\\', '/')
56+
JS.Path.resolve(path).Replace('\\', '/')
5657

5758
let getRelativePath (pathFrom: string) (pathTo: string) =
58-
Path.relative(pathFrom, pathTo).Replace('\\', '/')
59+
JS.Path.relative(pathFrom, pathTo).Replace('\\', '/')
5960

6061
#endif
6162

fcs/fcs-fable/test/package.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
2-
"name": "fcs-fable-test",
3-
"version": "1.0.0",
4-
"description": "FCS-Fable test",
5-
"keywords": [],
6-
"author": "",
7-
"license": "",
2+
"private": true,
83
"scripts": {
94
"build-test": "dotnet run -c Release -p ../../../../Fable/src/dotnet/Fable.Compiler npm-splitter",
105
"splitter": "node ./node_modules/fable-splitter/dist/cli --commonjs",
@@ -13,8 +8,8 @@
138
"bench-dotnet": "dotnet run -c Release -p fcs-fable-bench.fsproj ../fcs-fable.fsproj"
149
},
1510
"devDependencies": {
16-
"@babel/core": "^7.3.4",
17-
"@babel/plugin-transform-modules-commonjs": "^7.2.0",
18-
"fable-splitter": "^2.1.5"
11+
"@babel/core": "^7.4.0",
12+
"@babel/plugin-transform-modules-commonjs": "^7.4.0",
13+
"fable-splitter": "^2.1.6"
1914
}
2015
}

src/fsharp/range.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ type FileIndexTable() =
156156
| true, idx ->
157157
// Record the non-normalized entry if necessary
158158
if filePath <> normalizedFilePath then
159+
#if FABLE_COMPILER
160+
(
161+
#else
159162
lock fileToIndexTable (fun () ->
163+
#endif
160164
fileToIndexTable.[filePath] <- idx)
161165

162166
// Return the index

0 commit comments

Comments
 (0)