Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Commit e6b22c2

Browse files
committed
[WIP] Fable support update
1 parent 847eec6 commit e6b22c2

23 files changed

Lines changed: 1810 additions & 2065 deletions

src/absil/ilsupp.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,7 @@ let signerOpenKeyPairFile filePath = FileSystem.ReadAllBytesShim(filePath)
12971297

12981298
let signerGetPublicKeyForKeyPair (kp:keyPair) : pubkey =
12991299
#if EXPORT_SIGDATA
1300+
ignore kp
13001301
raise (NotImplementedException("signerGetPublicKeyForKeyPair is not yet implemented"))
13011302
#else
13021303
let reply = (StrongNameSign.getPublicKeyForKeyPair kp)
@@ -1311,13 +1312,15 @@ let signerCloseKeyContainer (_kc:keyContainerName) :unit =
13111312

13121313
let signerSignatureSize (pk:pubkey) : int =
13131314
#if EXPORT_SIGDATA
1315+
ignore pk
13141316
raise (NotImplementedException("signerSignatureSize is not yet implemented"))
13151317
#else
13161318
(StrongNameSign.signatureSize pk)
13171319
#endif
13181320

13191321
let signerSignFileWithKeyPair (fileName:string) (kp:keyPair) :unit =
13201322
#if EXPORT_SIGDATA
1323+
ignore fileName; ignore kp
13211324
raise (NotImplementedException("signerSignFileWithKeyPair is not yet implemented"))
13221325
#else
13231326
(StrongNameSign.signFile fileName kp)

src/fsharp/CompileOps.fs

Lines changed: 1373 additions & 1356 deletions
Large diffs are not rendered by default.

src/fsharp/Export.FCS/Export.FCS.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1414
<TargetFSharpCoreVersion>4.4.0.0</TargetFSharpCoreVersion>
15+
<ResolveNuGetPackages>false</ResolveNuGetPackages>
1516
<Name>Export.FCS</Name>
1617
</PropertyGroup>
1718
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

src/fsharp/Export.FCS/Program.fs

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,6 @@ open System.Collections.Generic
33
open Microsoft.FSharp.Compiler
44
open Microsoft.FSharp.Compiler.SourceCodeServices
55

6-
let input =
7-
"""
8-
printfn "answer=%A" 42
9-
10-
//type BB() = member x.MMM() = 2 * 3
11-
// open System
12-
//
13-
// let foo() =
14-
// let msg = String.Concat("Hello"," ","world")
15-
// if true then
16-
// printfn "%s" msg
17-
"""
18-
19-
// Create one global interactive checker instance
206
let checker = FSharpChecker.Create()
217

228
let parseAndCheckScript (file, input) =
@@ -31,20 +17,24 @@ let parseAndCheckScript (file, input) =
3117
| FSharpCheckFileAnswer.Succeeded(res) -> parseResult, res
3218
| res -> failwithf "Parsing did not finish... (%A)" res
3319

34-
let test() =
35-
let file = "/Test.fsx"
36-
let parseResult, typeCheckResults = parseAndCheckScript(file, input)
37-
38-
// We only expect one reported error. However,
39-
// on Unix, using filenames like /home/user/Test.fsx gives a second copy of all parse errors due to the
40-
// way the load closure for scripts is generated. So this returns two identical errors
41-
42-
// So we check that the messages are the same
43-
for msg in typeCheckResults.Errors do
44-
printfn "Error: %A" msg
45-
4620
[<EntryPoint>]
4721
let main argv =
48-
printfn "Parsing..."
49-
test()
50-
0 // return an integer exit code
22+
ignore argv
23+
printfn "Exporting metadata..."
24+
let file = "/Test.fsx"
25+
let input =
26+
#if DOTNETCORE
27+
"""
28+
#r "System.Private.CoreLib.dll"
29+
#r "System.Threading.dll"
30+
#r "System.Globalization.dll"
31+
#r "System.Reflection.Primitives.dll"
32+
#r "System.Resources.ResourceManager.dll"
33+
""" +
34+
#endif
35+
"""
36+
printfn "answer=%A" 42
37+
"""
38+
// parse script just to export metadata
39+
parseAndCheckScript(file, input) |> ignore
40+
0

src/fsharp/Export.FCS/project.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"version": "1.0.0-*",
3+
"buildOptions": {
4+
"debugType": "portable",
5+
"emitEntryPoint": true,
6+
"compilerName": "fsc",
7+
"compile": {
8+
"includeFiles": [
9+
"Program.fs"
10+
]
11+
},
12+
"define": [
13+
"DOTNETCORE",
14+
"TRACE"
15+
],
16+
"nowarn": [],
17+
"xmlDoc": true,
18+
"delaySign": true,
19+
"warningsAsErrors": true,
20+
"additionalArguments": [
21+
"--fullpaths",
22+
"--flaterrors",
23+
"--warnon:1182"
24+
]
25+
},
26+
"dependencies": {
27+
"Microsoft.FSharp.Core.netcore": "1.0.0-alpha-161111",
28+
"FSharp.Compiler.Service": {
29+
"version": "8.0.0",
30+
"target": "project"
31+
}
32+
},
33+
"tools": {
34+
"dotnet-compile-fsc": {
35+
"version": "1.0.0-preview2-*",
36+
"imports": "dnxcore50"
37+
}
38+
},
39+
"frameworks": {
40+
//"net462": {},
41+
"netcoreapp1.0": {
42+
"dependencies": {
43+
"Microsoft.NETCore.App": {
44+
"version": "1.0.0-*",
45+
"type": "platform"
46+
}
47+
}
48+
}
49+
}
50+
}

src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@
4848
<DefineConstants>$(DefineConstants);COMPILER_SERVICE</DefineConstants>
4949
<DefineConstants>$(DefineConstants);NO_STRONG_NAMES</DefineConstants>
5050
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
51-
<!--<DefineConstants>$(DefineConstants);EXPORT_SIGDATA</DefineConstants>-->
52-
<!--<DefineConstants>$(DefineConstants);FX_NO_CORHOST_SIGNER</DefineConstants>-->
53-
<!--<DefineConstants>$(DefineConstants);FX_NO_LINKEDRESOURCES</DefineConstants>-->
54-
<!--<DefineConstants>$(DefineConstants);FX_NO_PDB_READER</DefineConstants>-->
55-
<!--<DefineConstants>$(DefineConstants);FX_NO_PDB_WRITER</DefineConstants>-->
51+
52+
<!-- uncomment these to export metadata -->
53+
<!--
54+
<DefineConstants>$(DefineConstants);EXPORT_SIGDATA</DefineConstants>
55+
<DefineConstants>$(DefineConstants);FX_NO_CORHOST_SIGNER</DefineConstants>
56+
<DefineConstants>$(DefineConstants);FX_NO_LINKEDRESOURCES</DefineConstants>
57+
<DefineConstants>$(DefineConstants);FX_NO_PDB_READER</DefineConstants>
58+
<DefineConstants>$(DefineConstants);FX_NO_PDB_WRITER</DefineConstants>
59+
-->
5660
<TargetFSharpCoreVersion>4.4.0.0</TargetFSharpCoreVersion>
5761
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\..\..\</SolutionDir>
5862
<TargetFrameworkProfile />

src/fsharp/FSharp.Compiler.Service/project.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,13 @@
268268
"--warnon:1182"
269269
]
270270
},
271+
"configurations": {
272+
"ExportMeta": {
273+
"buildOptions": {
274+
"define": [ "EXPORT_SIGDATA" ]
275+
}
276+
}
277+
},
271278
"dependencies": {
272279
"NETStandard.Library": "1.6.0",
273280
"System.Collections.Immutable": "1.2.0",

src/fsharp/Fable.FCS/Fable.FCS.fsx

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
#load
2+
"fsstrings.fs"
3+
"unicode.fs"
4+
// "math/n.fsi"
5+
// "math/n.fs"
6+
// "math/z.fsi"
7+
// "math/z.fs"
8+
"adapters.fs"
9+
// "../../assemblyinfo/assemblyinfo.FSharp.Compiler.Service.dll.fs"
10+
// "../../assemblyinfo/assemblyinfo.shared.fs"
11+
"../FSharp.Compiler.Service/FSComp.fs"
12+
"../FSharp.Compiler.Service/FSIstrings.fs"
13+
// "../../utils/reshapedreflection.fs"
14+
// "../../utils/sformat.fsi"
15+
// "../../utils/sformat.fs"
16+
// "../sr.fsi"
17+
// "../sr.fs"
18+
"../../utils/prim-lexing.fsi"
19+
"../../utils/prim-lexing.fs"
20+
"../../utils/prim-parsing.fsi"
21+
"../../utils/prim-parsing.fs"
22+
"../../utils/ResizeArray.fsi"
23+
"../../utils/ResizeArray.fs"
24+
"../../utils/HashMultiMap.fsi"
25+
"../../utils/HashMultiMap.fs"
26+
"../../utils/EditDistance.fs"
27+
"../../utils/TaggedCollections.fsi"
28+
"../../utils/TaggedCollections.fs"
29+
"../QueueList.fs"
30+
"../../absil/ildiag.fsi"
31+
"../../absil/ildiag.fs"
32+
"../../absil/illib.fs"
33+
"../../utils/filename.fsi"
34+
"../../utils/filename.fs"
35+
"../../absil/bytes.fsi"
36+
"../../absil/bytes.fs"
37+
"../../absil/zmap.fsi"
38+
"../../absil/zmap.fs"
39+
"../../absil/zset.fsi"
40+
"../../absil/zset.fs"
41+
"../lib.fs"
42+
"../ErrorResolutionHints.fs"
43+
// "../InternalCollections.fsi"
44+
// "../InternalCollections.fs"
45+
"../rational.fsi"
46+
"../rational.fs"
47+
"../range.fsi"
48+
"../range.fs"
49+
"../ErrorLogger.fs"
50+
"../ReferenceResolver.fs"
51+
"../../absil/il.fsi"
52+
"../../absil/il.fs"
53+
"../../absil/ilx.fsi"
54+
"../../absil/ilx.fs"
55+
// "../../absil/ilascii.fsi"
56+
// "../../absil/ilascii.fs"
57+
// "../../absil/ilprint.fsi"
58+
// "../../absil/ilprint.fs"
59+
// "../../absil/ilmorph.fsi"
60+
// "../../absil/ilmorph.fs"
61+
// "../../absil/ilsign.fs"
62+
// "../../absil/ilsupp.fsi"
63+
// "../../absil/ilsupp.fs"
64+
// "ilpars.fs"
65+
// "illex.fs"
66+
"../../absil/ilbinary.fsi"
67+
"../../absil/ilbinary.fs"
68+
"../../absil/ilread.fsi"
69+
"../../absil/ilread.fs"
70+
// "../../absil/ilwritepdb.fsi"
71+
// "../../absil/ilwritepdb.fs"
72+
// "../../absil/ilwrite.fsi"
73+
// "../../absil/ilwrite.fs"
74+
// "../../absil/ilreflect.fs"
75+
// "../../utils/CompilerLocationUtils.fs"
76+
"../PrettyNaming.fs"
77+
"../../ilx/ilxsettings.fs"
78+
// "../../ilx/EraseClosures.fsi"
79+
// "../../ilx/EraseClosures.fs"
80+
// "../../ilx/EraseUnions.fsi"
81+
// "../../ilx/EraseUnions.fs"
82+
"../UnicodeLexing.fsi"
83+
"../UnicodeLexing.fs"
84+
"../layout.fsi"
85+
"../layout.fs"
86+
"../ast.fs"
87+
"../FSharp.Compiler.Service/pppars.fs"
88+
"../FSharp.Compiler.Service/pars.fs"
89+
"../lexhelp.fsi"
90+
"../lexhelp.fs"
91+
"../FSharp.Compiler.Service/pplex.fs"
92+
"../FSharp.Compiler.Service/lex.fs"
93+
"../LexFilter.fs"
94+
// "../tainted.fsi"
95+
// "../tainted.fs"
96+
// "../ExtensionTyping.fsi"
97+
// "../ExtensionTyping.fs"
98+
"../QuotationPickler.fsi"
99+
"../QuotationPickler.fs"
100+
"../tast.fs"
101+
"../TcGlobals.fs"
102+
"../TastOps.fsi"
103+
"../TastOps.fs"
104+
"../TastPickle.fsi"
105+
"../TastPickle.fs"
106+
"../import.fsi"
107+
"../import.fs"
108+
"../infos.fs"
109+
"../AccessibilityLogic.fs"
110+
"../AttributeChecking.fs"
111+
"../InfoReader.fs"
112+
"../NicePrint.fs"
113+
"../AugmentWithHashCompare.fsi"
114+
"../AugmentWithHashCompare.fs"
115+
"../NameResolution.fsi"
116+
"../NameResolution.fs"
117+
"../TypeRelations.fs"
118+
"../SignatureConformance.fs"
119+
"../MethodOverrides.fs"
120+
"../MethodCalls.fs"
121+
"../PatternMatchCompilation.fsi"
122+
"../PatternMatchCompilation.fs"
123+
"../ConstraintSolver.fsi"
124+
"../ConstraintSolver.fs"
125+
"../CheckFormatStrings.fsi"
126+
"../CheckFormatStrings.fs"
127+
"../FindUnsolved.fs"
128+
"../QuotationTranslator.fsi"
129+
"../QuotationTranslator.fs"
130+
"../PostInferenceChecks.fsi"
131+
"../PostInferenceChecks.fs"
132+
"../TypeChecker.fsi"
133+
"../TypeChecker.fs"
134+
"../Optimizer.fsi"
135+
"../Optimizer.fs"
136+
// "../DetupleArgs.fsi"
137+
// "../DetupleArgs.fs"
138+
// "../InnerLambdasToTopLevelFuncs.fsi"
139+
// "../InnerLambdasToTopLevelFuncs.fs"
140+
// "../LowerCallsAndSeqs.fs"
141+
// "../autobox.fs"
142+
// "../IlxGen.fsi"
143+
// "../IlxGen.fs"
144+
// "../CompileOps.fsi"
145+
"../CompileOps.fs"
146+
// "../CompileOptions.fsi"
147+
// "../CompileOptions.fs"
148+
// "../fsc.fsi"
149+
// "../fsc.fs"
150+
// "../vs/IncrementalBuild.fsi"
151+
// "../vs/IncrementalBuild.fs"
152+
// "../vs/Reactor.fsi"
153+
// "../vs/Reactor.fs"
154+
"../vs/ServiceConstants.fs"
155+
"../vs/ServiceDeclarations.fsi"
156+
"../vs/ServiceDeclarations.fs"
157+
"../vs/Symbols.fsi"
158+
"../vs/Symbols.fs"
159+
"../vs/Exprs.fsi"
160+
"../vs/Exprs.fs"
161+
// "../vs/ServiceLexing.fsi"
162+
// "../vs/ServiceLexing.fs"
163+
// "../vs/ServiceParseTreeWalk.fs"
164+
// "../vs/ServiceNavigation.fsi"
165+
// "../vs/ServiceNavigation.fs"
166+
// "../vs/ServiceParamInfoLocations.fsi"
167+
// "../vs/ServiceParamInfoLocations.fs"
168+
// "../vs/ServiceUntypedParse.fsi"
169+
// "../vs/ServiceUntypedParse.fs"
170+
// "../../utils/reshapedmsbuild.fs"
171+
// "../MSBuildReferenceResolver.fs"
172+
// "../vs/service.fsi"
173+
// "../vs/service.fs"
174+
// "../vs/SimpleServices.fsi"
175+
// "../vs/SimpleServices.fs"
176+
// "../fsi/fsi.fsi"
177+
// "../fsi/fsi.fs"
178+
"service_shim.fs"

src/fsharp/Fable.FCS/adapters.fs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,3 @@ module ErrorScope =
263263
type internal IReactorOperations =
264264
abstract EnqueueAndAwaitOpAsync : string * (unit -> 'T) -> Async<'T>
265265
abstract EnqueueOp: string * (unit -> unit) -> unit
266-
267-
//-------------------------------------------------------------------------
268-
// From illib.fs
269-
//------------------------------------------------------------------------
270-
module FileSystem =
271-
//let bytes = require("fs").readFileSync(fileName); // JS only
272-
//let ReadAllBytesShim (fileName:string) = [|0uy|]
273-
let ReadAllBytesShim (fileName:string) = System.IO.File.ReadAllBytes(fileName)

0 commit comments

Comments
 (0)