firefly-compiler 0.4.17 → 0.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/Builder.ff +1 -1
- package/compiler/Compiler.ff +6 -5
- package/compiler/Inference.ff +31 -19
- package/compiler/JsEmitter.ff +98 -71
- package/compiler/JsImporter.ff +1 -1
- package/compiler/LspHook.ff +4 -4
- package/compiler/Main.ff +6 -6
- package/compiler/Parser.ff +39 -39
- package/compiler/Patterns.ff +2 -0
- package/compiler/Syntax.ff +1 -1
- package/compiler/Tokenizer.ff +2 -2
- package/compiler/Workspace.ff +2 -2
- package/core/Array.ff +135 -294
- package/core/Buffer.ff +3 -3
- package/core/BuildSystem.ff +1 -1
- package/core/Equal.ff +36 -52
- package/core/HttpClient.ff +1 -1
- package/core/IntMap.ff +14 -18
- package/core/JsSystem.ff +1 -1
- package/core/JsValue.ff +6 -12
- package/core/Json.ff +19 -28
- package/core/List.ff +281 -312
- package/core/Map.ff +4 -8
- package/core/NodeSystem.ff +2 -2
- package/core/Option.ff +0 -4
- package/core/Ordering.ff +10 -6
- package/core/Pair.ff +0 -4
- package/core/Random.ff +12 -26
- package/core/RbMap.ff +216 -216
- package/core/Serializable.ff +9 -18
- package/core/Set.ff +0 -1
- package/core/SourceLocation.ff +1 -1
- package/core/Stack.ff +32 -45
- package/core/Stream.ff +10 -14
- package/core/String.ff +24 -6
- package/core/StringMap.ff +15 -19
- package/guide/Main.ff +20 -2
- package/lsp/CompletionHandler.ff +4 -4
- package/lsp/Handler.ff +45 -34
- package/lsp/HoverHandler.ff +2 -2
- package/lsp/LanguageServer.ff +2 -2
- package/lsp/SignatureHelpHandler.ff +1 -1
- package/lsp/SymbolHandler.ff +1 -1
- package/lux/Lux.ff +3 -3
- package/output/js/ff/compiler/Builder.mjs +19 -21
- package/output/js/ff/compiler/Compiler.mjs +18 -20
- package/output/js/ff/compiler/Dependencies.mjs +8 -10
- package/output/js/ff/compiler/Deriver.mjs +234 -236
- package/output/js/ff/compiler/Dictionaries.mjs +6 -8
- package/output/js/ff/compiler/Environment.mjs +42 -44
- package/output/js/ff/compiler/Inference.mjs +346 -304
- package/output/js/ff/compiler/JsEmitter.mjs +907 -833
- package/output/js/ff/compiler/JsImporter.mjs +0 -2
- package/output/js/ff/compiler/LspHook.mjs +10 -12
- package/output/js/ff/compiler/Main.mjs +109 -111
- package/output/js/ff/compiler/Parser.mjs +405 -407
- package/output/js/ff/compiler/Patterns.mjs +64 -50
- package/output/js/ff/compiler/Resolver.mjs +36 -38
- package/output/js/ff/compiler/Substitution.mjs +4 -6
- package/output/js/ff/compiler/Syntax.mjs +160 -162
- package/output/js/ff/compiler/Token.mjs +52 -54
- package/output/js/ff/compiler/Tokenizer.mjs +16 -18
- package/output/js/ff/compiler/Unification.mjs +24 -26
- package/output/js/ff/compiler/Wildcards.mjs +0 -2
- package/output/js/ff/compiler/Workspace.mjs +18 -20
- package/output/js/ff/core/Any.mjs +0 -2
- package/output/js/ff/core/Array.mjs +216 -613
- package/output/js/ff/core/AssetSystem.mjs +2 -4
- package/output/js/ff/core/Atomic.mjs +0 -2
- package/output/js/ff/core/Bool.mjs +0 -2
- package/output/js/ff/core/Box.mjs +0 -2
- package/output/js/ff/core/BrowserSystem.mjs +0 -2
- package/output/js/ff/core/Buffer.mjs +0 -2
- package/output/js/ff/core/BuildSystem.mjs +12 -14
- package/output/js/ff/core/Channel.mjs +0 -2
- package/output/js/ff/core/Char.mjs +0 -2
- package/output/js/ff/core/Core.mjs +0 -2
- package/output/js/ff/core/Duration.mjs +0 -2
- package/output/js/ff/core/Equal.mjs +0 -22
- package/output/js/ff/core/Error.mjs +0 -2
- package/output/js/ff/core/FileHandle.mjs +0 -2
- package/output/js/ff/core/Float.mjs +0 -2
- package/output/js/ff/core/HttpClient.mjs +2 -4
- package/output/js/ff/core/Instant.mjs +0 -2
- package/output/js/ff/core/Int.mjs +8 -10
- package/output/js/ff/core/IntMap.mjs +32 -42
- package/output/js/ff/core/JsSystem.mjs +1 -3
- package/output/js/ff/core/JsValue.mjs +5 -12
- package/output/js/ff/core/Json.mjs +23 -56
- package/output/js/ff/core/List.mjs +648 -1989
- package/output/js/ff/core/Lock.mjs +0 -2
- package/output/js/ff/core/Log.mjs +0 -2
- package/output/js/ff/core/Map.mjs +10 -20
- package/output/js/ff/core/NodeSystem.mjs +6 -8
- package/output/js/ff/core/Nothing.mjs +0 -2
- package/output/js/ff/core/Option.mjs +8 -18
- package/output/js/ff/core/Ordering.mjs +20 -98
- package/output/js/ff/core/Pair.mjs +6 -16
- package/output/js/ff/core/Path.mjs +12 -14
- package/output/js/ff/core/Random.mjs +24 -54
- package/output/js/ff/core/RbMap.mjs +54 -56
- package/output/js/ff/core/Serializable.mjs +19 -36
- package/output/js/ff/core/Set.mjs +0 -14
- package/output/js/ff/core/Show.mjs +0 -2
- package/output/js/ff/core/SourceLocation.mjs +0 -2
- package/output/js/ff/core/Stream.mjs +34 -44
- package/output/js/ff/core/String.mjs +31 -5
- package/output/js/ff/core/StringMap.mjs +32 -42
- package/output/js/ff/core/Task.mjs +0 -2
- package/output/js/ff/core/Try.mjs +0 -2
- package/output/js/ff/core/Unit.mjs +0 -2
- package/package.json +1 -1
- package/vscode/package.json +1 -1
- package/webserver/WebServer.ff +8 -8
- package/output/js/ff/core/Stack.mjs +0 -603
package/lux/Lux.ff
CHANGED
|
@@ -8,7 +8,7 @@ capability Lux(
|
|
|
8
8
|
mutable cssClasses: StringMap[CssClass]
|
|
9
9
|
mutable renderLock: Lock
|
|
10
10
|
mutable task: Task
|
|
11
|
-
mutable renderQueue:
|
|
11
|
+
mutable renderQueue: Array[RenderQueueItem]
|
|
12
12
|
mutable element: LuxElement
|
|
13
13
|
mutable depth: Int
|
|
14
14
|
mutable keys: Option[StringMap[JsValue]]
|
|
@@ -294,7 +294,7 @@ extend self: Lux {
|
|
|
294
294
|
let lux = luxCopy.Lux(
|
|
295
295
|
task = task
|
|
296
296
|
renderLock = task.lock()
|
|
297
|
-
renderQueue =
|
|
297
|
+
renderQueue = Array.make()
|
|
298
298
|
element = luxCopy.element.LuxElement(element = fragment)
|
|
299
299
|
)
|
|
300
300
|
try {
|
|
@@ -475,7 +475,7 @@ render(browserSystem: BrowserSystem, element: JsValue, body: Lux => Unit) {
|
|
|
475
475
|
keys = None
|
|
476
476
|
key = ""
|
|
477
477
|
attributes = None
|
|
478
|
-
renderQueue =
|
|
478
|
+
renderQueue = Array.make()
|
|
479
479
|
)
|
|
480
480
|
lux.renderLock.do(reentrant = False) {
|
|
481
481
|
body(lux)
|
|
@@ -98,8 +98,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
|
|
|
98
98
|
|
|
99
99
|
import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
|
|
100
100
|
|
|
101
|
-
import * as ff_core_Stack from "../../ff/core/Stack.mjs"
|
|
102
|
-
|
|
103
101
|
import * as ff_core_Stream from "../../ff/core/Stream.mjs"
|
|
104
102
|
|
|
105
103
|
import * as ff_core_String from "../../ff/core/String.mjs"
|
|
@@ -178,16 +176,16 @@ return
|
|
|
178
176
|
}
|
|
179
177
|
{
|
|
180
178
|
if(!_1) {
|
|
181
|
-
const _guard1 = ff_core_Path.Path_endsWith(path_,
|
|
179
|
+
const _guard1 = ff_core_Path.Path_endsWith(path_, [".firefly", "package.ff"]);
|
|
182
180
|
if(_guard1) {
|
|
183
|
-
return
|
|
181
|
+
return [ff_compiler_Builder.PackageFiles(ff_core_Option.Option_grab(ff_core_Path.Path_parent(path_)), ff_core_Option.Some(path_), [])]
|
|
184
182
|
return
|
|
185
183
|
}
|
|
186
184
|
}
|
|
187
185
|
}
|
|
188
186
|
{
|
|
189
187
|
if(!_1) {
|
|
190
|
-
return
|
|
188
|
+
return [ff_compiler_Builder.PackageFiles(ff_core_Option.Option_grab(ff_core_Path.Path_parent(path_)), ff_core_Option.None(), [path_])]
|
|
191
189
|
return
|
|
192
190
|
}
|
|
193
191
|
}
|
|
@@ -218,7 +216,7 @@ ff_compiler_Compiler.Compiler_resolve(compiler_, resolvedDependencies_.mainPacka
|
|
|
218
216
|
export function findPackageFiles_(path_) {
|
|
219
217
|
const files_ = ff_compiler_Builder.findFireflyFiles_(path_);
|
|
220
218
|
const split_ = ff_core_List.List_partition(files_, ((_w1) => {
|
|
221
|
-
return ff_core_Path.Path_endsWith(_w1,
|
|
219
|
+
return ff_core_Path.Path_endsWith(_w1, [".firefly", "package.ff"])
|
|
222
220
|
}));
|
|
223
221
|
const packageFiles_ = split_.first_;
|
|
224
222
|
let singleFiles_ = split_.second_;
|
|
@@ -232,9 +230,9 @@ return ff_compiler_Builder.PackageFiles(projectRoot_, ff_core_Option.Some(packag
|
|
|
232
230
|
}));
|
|
233
231
|
const singleFileProjects_ = ff_core_List.List_map(singleFiles_, ((file_) => {
|
|
234
232
|
const projectRoot_ = ff_core_Option.Option_grab(ff_core_Path.Path_parent(file_));
|
|
235
|
-
return ff_compiler_Builder.PackageFiles(projectRoot_, ff_core_Option.None(),
|
|
233
|
+
return ff_compiler_Builder.PackageFiles(projectRoot_, ff_core_Option.None(), [file_])
|
|
236
234
|
}));
|
|
237
|
-
return
|
|
235
|
+
return [...multiFileProjects_, ...singleFileProjects_]
|
|
238
236
|
}
|
|
239
237
|
|
|
240
238
|
export function findFireflyFiles_(path_) {
|
|
@@ -253,12 +251,12 @@ return ff_core_Path.PathEntry_path(_w1)
|
|
|
253
251
|
})), ((_w1) => {
|
|
254
252
|
return (ff_core_Path.Path_extension(_w1) === ".ff")
|
|
255
253
|
}));
|
|
256
|
-
return
|
|
254
|
+
return [...fireflyFiles_, ...ff_core_List.List_flatMap(directories_, ((_w1) => {
|
|
257
255
|
return ff_compiler_Builder.findFireflyFiles_(_w1)
|
|
258
|
-
}))
|
|
256
|
+
}))]
|
|
259
257
|
}
|
|
260
258
|
|
|
261
|
-
export function internalCreateExecutable_(self_, mainJsFile_ = ".firefly/output/executable/Main.bundle.js", outputPath_ = ".firefly/output", targets_ =
|
|
259
|
+
export function internalCreateExecutable_(self_, mainJsFile_ = ".firefly/output/executable/Main.bundle.js", outputPath_ = ".firefly/output", targets_ = ["host"], assets_ = ff_core_AssetSystem.create_()) {
|
|
262
260
|
const assetOutputPath_ = ff_core_Path.Path_slash(outputPath_, "assets");
|
|
263
261
|
ff_core_List.List_each(ff_core_Map.Map_pairs(assets_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
|
|
264
262
|
{
|
|
@@ -357,16 +355,16 @@ return
|
|
|
357
355
|
}
|
|
358
356
|
{
|
|
359
357
|
if(!_1) {
|
|
360
|
-
const _guard1 = (await ff_core_Path.Path_endsWith$(path_,
|
|
358
|
+
const _guard1 = (await ff_core_Path.Path_endsWith$(path_, [".firefly", "package.ff"], $task));
|
|
361
359
|
if(_guard1) {
|
|
362
|
-
return
|
|
360
|
+
return [ff_compiler_Builder.PackageFiles(ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(path_, $task))), ff_core_Option.Some(path_), [])]
|
|
363
361
|
return
|
|
364
362
|
}
|
|
365
363
|
}
|
|
366
364
|
}
|
|
367
365
|
{
|
|
368
366
|
if(!_1) {
|
|
369
|
-
return
|
|
367
|
+
return [ff_compiler_Builder.PackageFiles(ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(path_, $task))), ff_core_Option.None(), [path_])]
|
|
370
368
|
return
|
|
371
369
|
}
|
|
372
370
|
}
|
|
@@ -397,7 +395,7 @@ if(infer_) {
|
|
|
397
395
|
export async function findPackageFiles_$(path_, $task) {
|
|
398
396
|
const files_ = (await ff_compiler_Builder.findFireflyFiles_$(path_, $task));
|
|
399
397
|
const split_ = (await ff_core_List.List_partition$(files_, (async (_w1, $task) => {
|
|
400
|
-
return (await ff_core_Path.Path_endsWith$(_w1,
|
|
398
|
+
return (await ff_core_Path.Path_endsWith$(_w1, [".firefly", "package.ff"], $task))
|
|
401
399
|
}), $task));
|
|
402
400
|
const packageFiles_ = split_.first_;
|
|
403
401
|
let singleFiles_ = split_.second_;
|
|
@@ -411,9 +409,9 @@ return ff_compiler_Builder.PackageFiles(projectRoot_, ff_core_Option.Some(packag
|
|
|
411
409
|
}), $task));
|
|
412
410
|
const singleFileProjects_ = (await ff_core_List.List_map$(singleFiles_, (async (file_, $task) => {
|
|
413
411
|
const projectRoot_ = ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(file_, $task)));
|
|
414
|
-
return ff_compiler_Builder.PackageFiles(projectRoot_, ff_core_Option.None(),
|
|
412
|
+
return ff_compiler_Builder.PackageFiles(projectRoot_, ff_core_Option.None(), [file_])
|
|
415
413
|
}), $task));
|
|
416
|
-
return
|
|
414
|
+
return [...multiFileProjects_, ...singleFileProjects_]
|
|
417
415
|
}
|
|
418
416
|
|
|
419
417
|
export async function findFireflyFiles_$(path_, $task) {
|
|
@@ -432,12 +430,12 @@ return (await ff_core_Path.PathEntry_path$(_w1, $task))
|
|
|
432
430
|
}), $task)), (async (_w1, $task) => {
|
|
433
431
|
return ((await ff_core_Path.Path_extension$(_w1, $task)) === ".ff")
|
|
434
432
|
}), $task));
|
|
435
|
-
return
|
|
433
|
+
return [...fireflyFiles_, ...(await ff_core_List.List_flatMap$(directories_, (async (_w1, $task) => {
|
|
436
434
|
return (await ff_compiler_Builder.findFireflyFiles_$(_w1, $task))
|
|
437
|
-
}), $task))
|
|
435
|
+
}), $task))]
|
|
438
436
|
}
|
|
439
437
|
|
|
440
|
-
export async function internalCreateExecutable_$(self_, mainJsFile_ = ".firefly/output/executable/Main.bundle.js", outputPath_ = ".firefly/output", targets_ =
|
|
438
|
+
export async function internalCreateExecutable_$(self_, mainJsFile_ = ".firefly/output/executable/Main.bundle.js", outputPath_ = ".firefly/output", targets_ = ["host"], assets_ = ff_core_AssetSystem.create_(), $task) {
|
|
441
439
|
const assetOutputPath_ = (await ff_core_Path.Path_slash$(outputPath_, "assets", $task));
|
|
442
440
|
(await ff_core_List.List_each$(ff_core_Map.Map_pairs(assets_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (async (_1, $task) => {
|
|
443
441
|
{
|
|
@@ -479,7 +477,7 @@ export async function internalCallPkg_$(self_, packageFile_, outputPath_, target
|
|
|
479
477
|
return await pkg.exec([
|
|
480
478
|
packageFile_,
|
|
481
479
|
'--out-path', outputPath_,
|
|
482
|
-
'--target',
|
|
480
|
+
'--target', targets_.join(',')
|
|
483
481
|
])
|
|
484
482
|
|
|
485
483
|
}
|
|
@@ -100,8 +100,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
|
|
|
100
100
|
|
|
101
101
|
import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
|
|
102
102
|
|
|
103
|
-
import * as ff_core_Stack from "../../ff/core/Stack.mjs"
|
|
104
|
-
|
|
105
103
|
import * as ff_core_Stream from "../../ff/core/Stream.mjs"
|
|
106
104
|
|
|
107
105
|
import * as ff_core_String from "../../ff/core/String.mjs"
|
|
@@ -115,16 +113,16 @@ import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
|
115
113
|
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
116
114
|
|
|
117
115
|
// type Compiler
|
|
118
|
-
export function Compiler(emitTarget_, task_, compilerModulePath_, jsOutputPath_, packagePaths_, singleFilePackages_, virtualFiles_, lspHook_, parsedModules_, resolvedModules_, derivedModules_, inferredModules_, emittedModules_,
|
|
119
|
-
return {emitTarget_, task_, compilerModulePath_, jsOutputPath_, packagePaths_, singleFilePackages_, virtualFiles_, lspHook_, parsedModules_, resolvedModules_, derivedModules_, inferredModules_, emittedModules_,
|
|
116
|
+
export function Compiler(emitTarget_, task_, compilerModulePath_, jsOutputPath_, packagePaths_, singleFilePackages_, virtualFiles_, lspHook_, parsedModules_, resolvedModules_, derivedModules_, inferredModules_, emittedModules_, phaseDurationDelta_, phaseDurations_) {
|
|
117
|
+
return {emitTarget_, task_, compilerModulePath_, jsOutputPath_, packagePaths_, singleFilePackages_, virtualFiles_, lspHook_, parsedModules_, resolvedModules_, derivedModules_, inferredModules_, emittedModules_, phaseDurationDelta_, phaseDurations_};
|
|
120
118
|
}
|
|
121
119
|
|
|
122
|
-
export const coreImports_ = ff_core_List.List_map(
|
|
123
|
-
return ff_compiler_Syntax.DImport(ff_compiler_Syntax.Location("<prelude>", 1, 1), moduleName_, ff_compiler_Syntax.PackagePair("ff", "core"),
|
|
120
|
+
export const coreImports_ = ff_core_List.List_map(["Any", "Array", "AssetSystem", "Atomic", "Bool", "Box", "BrowserSystem", "Buffer", "BuildSystem", "Channel", "Char", "Core", "Duration", "Equal", "Error", "FileHandle", "Float", "HttpClient", "Instant", "Int", "IntMap", "Json", "JsValue", "JsSystem", "List", "Lock", "Log", "Map", "NodeSystem", "Nothing", "Option", "Ordering", "Pair", "Path", "Random", "Serializable", "Set", "Show", "SourceLocation", "Stream", "String", "StringMap", "Task", "Try", "Unit"], ((moduleName_) => {
|
|
121
|
+
return ff_compiler_Syntax.DImport(ff_compiler_Syntax.Location("<prelude>", 1, 1), moduleName_, ff_compiler_Syntax.PackagePair("ff", "core"), [], moduleName_)
|
|
124
122
|
}));
|
|
125
123
|
|
|
126
124
|
export function make_(emitTarget_, task_, compilerModulePath_, jsOutputPath_, resolvedDependencies_, virtualFiles_, lspHook_) {
|
|
127
|
-
return ff_compiler_Compiler.Compiler(emitTarget_, task_, compilerModulePath_, jsOutputPath_, resolvedDependencies_.packagePaths_, resolvedDependencies_.singleFilePackages_, virtualFiles_, lspHook_, ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Set.empty_(),
|
|
125
|
+
return ff_compiler_Compiler.Compiler(emitTarget_, task_, compilerModulePath_, jsOutputPath_, resolvedDependencies_.packagePaths_, resolvedDependencies_.singleFilePackages_, virtualFiles_, lspHook_, ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Set.empty_(), 0.0, ff_core_List.List_toArray([]))
|
|
128
126
|
}
|
|
129
127
|
|
|
130
128
|
export function fail_(at_, message_) {
|
|
@@ -132,7 +130,7 @@ return ff_core_Core.panic_(((message_ + " ") + ff_compiler_Syntax.Location_show(
|
|
|
132
130
|
}
|
|
133
131
|
|
|
134
132
|
export async function make_$(emitTarget_, task_, compilerModulePath_, jsOutputPath_, resolvedDependencies_, virtualFiles_, lspHook_, $task) {
|
|
135
|
-
return ff_compiler_Compiler.Compiler(emitTarget_, task_, compilerModulePath_, jsOutputPath_, resolvedDependencies_.packagePaths_, resolvedDependencies_.singleFilePackages_, virtualFiles_, lspHook_, ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Set.empty_(),
|
|
133
|
+
return ff_compiler_Compiler.Compiler(emitTarget_, task_, compilerModulePath_, jsOutputPath_, resolvedDependencies_.packagePaths_, resolvedDependencies_.singleFilePackages_, virtualFiles_, lspHook_, ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Map.empty_(), ff_core_Set.empty_(), 0.0, ff_core_List.List_toArray([]))
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
export async function fail_$(at_, message_, $task) {
|
|
@@ -146,12 +144,12 @@ const stop_ = (ff_core_Task.Task_elapsed(self_.task_) - self_.phaseDurationDelta
|
|
|
146
144
|
const duration_ = (stop_ - start_);
|
|
147
145
|
self_.phaseDurationDelta_ = (self_.phaseDurationDelta_ + duration_);
|
|
148
146
|
const text_ = ((((phase_ + " ") + ff_compiler_Syntax.PackagePair_groupName(packagePair_, ":")) + "/") + moduleName_);
|
|
149
|
-
self_.phaseDurations_
|
|
147
|
+
ff_core_Array.Array_push(self_.phaseDurations_, ff_core_Pair.Pair(text_, duration_));
|
|
150
148
|
return result_
|
|
151
149
|
}
|
|
152
150
|
|
|
153
151
|
export function Compiler_printMeasurements(self_) {
|
|
154
|
-
const worst_ = ff_core_List.List_reverse(ff_core_List.List_takeLast(ff_core_List.List_sortBy(self_.phaseDurations_, ((_w1) => {
|
|
152
|
+
const worst_ = ff_core_List.List_reverse(ff_core_List.List_takeLast(ff_core_List.List_sortBy(ff_core_Array.Array_toList(self_.phaseDurations_, 0, 9007199254740991), ((_w1) => {
|
|
155
153
|
return ((_w1.second_ + 1000000.0) + "")
|
|
156
154
|
}), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), 5));
|
|
157
155
|
ff_core_List.List_each(worst_, ((_1) => {
|
|
@@ -190,7 +188,7 @@ const module_ = (ff_core_Set.Set_contains(self_.singleFilePackages_, packagePair
|
|
|
190
188
|
? ff_compiler_Parser.Parser_parseModuleWithPackageInfo(parser_).module_
|
|
191
189
|
: ff_compiler_Parser.Parser_parseModuleWithoutPackageInfo(parser_));
|
|
192
190
|
const result_ = (((_c) => {
|
|
193
|
-
return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_,
|
|
191
|
+
return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, [...ff_compiler_Compiler.coreImports_, ...module_.imports_], _c.types_, _c.traits_, _c.instances_, _c.extends_, _c.lets_, _c.functions_)
|
|
194
192
|
}))(module_);
|
|
195
193
|
self_.parsedModules_ = ff_core_Map.Map_add(self_.parsedModules_, ((packageName_ + ":") + moduleName_), result_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
196
194
|
return result_
|
|
@@ -245,9 +243,9 @@ const module_ = ff_compiler_Compiler.Compiler_derive(self_, packagePair_, module
|
|
|
245
243
|
const otherModules_ = ff_core_List.List_map(ff_compiler_Compiler.Compiler_imports(self_, module_), ((i_) => {
|
|
246
244
|
return ff_compiler_Compiler.Compiler_derive(self_, i_.packagePair_, ff_core_String.String_dropLast(i_.file_, ff_core_String.String_size(".ff")))
|
|
247
245
|
}));
|
|
248
|
-
const inference_ = ff_compiler_Inference.make_(
|
|
246
|
+
const inference_ = ff_compiler_Inference.make_([module_, ...otherModules_], self_.lspHook_);
|
|
249
247
|
const inferredModule_ = ff_compiler_Inference.Inference_inferModule(inference_, module_, otherModules_);
|
|
250
|
-
const result_ = ff_compiler_Dictionaries.Dictionaries_processModule(ff_compiler_Dictionaries.make_(
|
|
248
|
+
const result_ = ff_compiler_Dictionaries.Dictionaries_processModule(ff_compiler_Dictionaries.make_([module_, ...otherModules_]), inferredModule_, otherModules_);
|
|
251
249
|
self_.inferredModules_ = ff_core_Map.Map_add(self_.inferredModules_, ((packageName_ + ":") + moduleName_), result_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
252
250
|
return result_
|
|
253
251
|
}))
|
|
@@ -267,7 +265,7 @@ const newModuleName_ = ff_core_String.String_dropLast(i_.file_, ff_core_String.S
|
|
|
267
265
|
ff_compiler_Compiler.Compiler_emit(self_, i_.packagePair_, newModuleName_, false);
|
|
268
266
|
return ff_compiler_Compiler.Compiler_infer(self_, i_.packagePair_, newModuleName_)
|
|
269
267
|
}));
|
|
270
|
-
const allModules_ =
|
|
268
|
+
const allModules_ = [module_, ...otherModules_];
|
|
271
269
|
const js_ = ff_compiler_JsEmitter.JsEmitter_emitModule(ff_compiler_JsEmitter.make_(allModules_, self_.emitTarget_, isMainModule_, self_.compilerModulePath_, packagePair_, moduleName_), packagePair_, module_);
|
|
272
270
|
const jsPath_ = ff_core_Path.Path_slash(ff_core_Path.Path_slash(self_.jsOutputPath_, packagePair_.group_), packagePair_.name_);
|
|
273
271
|
const jsFile_ = ff_core_Path.Path_slash(jsPath_, (moduleName_ + ".mjs"));
|
|
@@ -284,12 +282,12 @@ const stop_ = ((await ff_core_Task.Task_elapsed$(self_.task_, $task)) - self_.ph
|
|
|
284
282
|
const duration_ = (stop_ - start_);
|
|
285
283
|
self_.phaseDurationDelta_ = (self_.phaseDurationDelta_ + duration_);
|
|
286
284
|
const text_ = ((((phase_ + " ") + ff_compiler_Syntax.PackagePair_groupName(packagePair_, ":")) + "/") + moduleName_);
|
|
287
|
-
self_.phaseDurations_
|
|
285
|
+
ff_core_Array.Array_push(self_.phaseDurations_, ff_core_Pair.Pair(text_, duration_));
|
|
288
286
|
return result_
|
|
289
287
|
}
|
|
290
288
|
|
|
291
289
|
export async function Compiler_printMeasurements$(self_, $task) {
|
|
292
|
-
const worst_ = ff_core_List.List_reverse(ff_core_List.List_takeLast(ff_core_List.List_sortBy(self_.phaseDurations_, ((_w1) => {
|
|
290
|
+
const worst_ = ff_core_List.List_reverse(ff_core_List.List_takeLast(ff_core_List.List_sortBy(ff_core_Array.Array_toList(self_.phaseDurations_, 0, 9007199254740991), ((_w1) => {
|
|
293
291
|
return ((_w1.second_ + 1000000.0) + "")
|
|
294
292
|
}), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), 5));
|
|
295
293
|
ff_core_List.List_each(worst_, ((_1) => {
|
|
@@ -328,7 +326,7 @@ const module_ = (ff_core_Set.Set_contains(self_.singleFilePackages_, packagePair
|
|
|
328
326
|
? ff_compiler_Parser.Parser_parseModuleWithPackageInfo(parser_).module_
|
|
329
327
|
: ff_compiler_Parser.Parser_parseModuleWithoutPackageInfo(parser_));
|
|
330
328
|
const result_ = (((_c) => {
|
|
331
|
-
return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_,
|
|
329
|
+
return ff_compiler_Syntax.Module(_c.file_, _c.packagePair_, [...ff_compiler_Compiler.coreImports_, ...module_.imports_], _c.types_, _c.traits_, _c.instances_, _c.extends_, _c.lets_, _c.functions_)
|
|
332
330
|
}))(module_);
|
|
333
331
|
self_.parsedModules_ = ff_core_Map.Map_add(self_.parsedModules_, ((packageName_ + ":") + moduleName_), result_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
334
332
|
return result_
|
|
@@ -383,9 +381,9 @@ const module_ = (await ff_compiler_Compiler.Compiler_derive$(self_, packagePair_
|
|
|
383
381
|
const otherModules_ = (await ff_core_List.List_map$((await ff_compiler_Compiler.Compiler_imports$(self_, module_, $task)), (async (i_, $task) => {
|
|
384
382
|
return (await ff_compiler_Compiler.Compiler_derive$(self_, i_.packagePair_, ff_core_String.String_dropLast(i_.file_, ff_core_String.String_size(".ff")), $task))
|
|
385
383
|
}), $task));
|
|
386
|
-
const inference_ = ff_compiler_Inference.make_(
|
|
384
|
+
const inference_ = ff_compiler_Inference.make_([module_, ...otherModules_], self_.lspHook_);
|
|
387
385
|
const inferredModule_ = ff_compiler_Inference.Inference_inferModule(inference_, module_, otherModules_);
|
|
388
|
-
const result_ = ff_compiler_Dictionaries.Dictionaries_processModule(ff_compiler_Dictionaries.make_(
|
|
386
|
+
const result_ = ff_compiler_Dictionaries.Dictionaries_processModule(ff_compiler_Dictionaries.make_([module_, ...otherModules_]), inferredModule_, otherModules_);
|
|
389
387
|
self_.inferredModules_ = ff_core_Map.Map_add(self_.inferredModules_, ((packageName_ + ":") + moduleName_), result_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
|
|
390
388
|
return result_
|
|
391
389
|
}), $task))
|
|
@@ -405,7 +403,7 @@ const newModuleName_ = ff_core_String.String_dropLast(i_.file_, ff_core_String.S
|
|
|
405
403
|
(await ff_compiler_Compiler.Compiler_emit$(self_, i_.packagePair_, newModuleName_, false, $task));
|
|
406
404
|
return (await ff_compiler_Compiler.Compiler_infer$(self_, i_.packagePair_, newModuleName_, $task))
|
|
407
405
|
}), $task));
|
|
408
|
-
const allModules_ =
|
|
406
|
+
const allModules_ = [module_, ...otherModules_];
|
|
409
407
|
const js_ = (await ff_compiler_JsEmitter.JsEmitter_emitModule$((await ff_compiler_JsEmitter.make_$(allModules_, self_.emitTarget_, isMainModule_, self_.compilerModulePath_, packagePair_, moduleName_, $task)), packagePair_, module_, $task));
|
|
410
408
|
const jsPath_ = (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(self_.jsOutputPath_, packagePair_.group_, $task)), packagePair_.name_, $task));
|
|
411
409
|
const jsFile_ = (await ff_core_Path.Path_slash$(jsPath_, (moduleName_ + ".mjs"), $task));
|
|
@@ -90,8 +90,6 @@ import * as ff_core_Show from "../../ff/core/Show.mjs"
|
|
|
90
90
|
|
|
91
91
|
import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
|
|
92
92
|
|
|
93
|
-
import * as ff_core_Stack from "../../ff/core/Stack.mjs"
|
|
94
|
-
|
|
95
93
|
import * as ff_core_Stream from "../../ff/core/Stream.mjs"
|
|
96
94
|
|
|
97
95
|
import * as ff_core_String from "../../ff/core/String.mjs"
|
|
@@ -118,7 +116,7 @@ return {mainPackagePair_, packages_, packagePaths_, singleFilePackages_};
|
|
|
118
116
|
|
|
119
117
|
export function process_(fetch_, path_) {
|
|
120
118
|
const workspace_ = ff_compiler_Workspace.loadWorkspace_(path_);
|
|
121
|
-
const self_ = ff_compiler_Dependencies.Dependencies(workspace_, ff_core_List.List_toMap(
|
|
119
|
+
const self_ = ff_compiler_Dependencies.Dependencies(workspace_, ff_core_List.List_toMap([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair));
|
|
122
120
|
const packageInfo_ = ff_compiler_Dependencies.Dependencies_loadPackageInfo(self_, ff_compiler_Syntax.PackagePair("script", "script"), path_);
|
|
123
121
|
const newDependencies_ = ff_compiler_Dependencies.Dependencies_processPackageInfo(self_, packageInfo_);
|
|
124
122
|
ff_compiler_Dependencies.Dependencies_processDependencies(self_, path_, fetch_, newDependencies_);
|
|
@@ -155,7 +153,7 @@ throw new Error('Function internalExtractTarGz is missing on this target in sync
|
|
|
155
153
|
|
|
156
154
|
export async function process_$(fetch_, path_, $task) {
|
|
157
155
|
const workspace_ = (await ff_compiler_Workspace.loadWorkspace_$(path_, $task));
|
|
158
|
-
const self_ = ff_compiler_Dependencies.Dependencies(workspace_, ff_core_List.List_toMap(
|
|
156
|
+
const self_ = ff_compiler_Dependencies.Dependencies(workspace_, ff_core_List.List_toMap([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair));
|
|
159
157
|
const packageInfo_ = (await ff_compiler_Dependencies.Dependencies_loadPackageInfo$(self_, ff_compiler_Syntax.PackagePair("script", "script"), path_, $task));
|
|
160
158
|
const newDependencies_ = (await ff_compiler_Dependencies.Dependencies_processPackageInfo$(self_, packageInfo_, $task));
|
|
161
159
|
(await ff_compiler_Dependencies.Dependencies_processDependencies$(self_, path_, fetch_, newDependencies_, $task));
|
|
@@ -226,7 +224,7 @@ const coreDependency_ = ff_compiler_Syntax.DDependency(info_.package_.at_, ff_co
|
|
|
226
224
|
const _1 = info_;
|
|
227
225
|
{
|
|
228
226
|
const _c = _1;
|
|
229
|
-
return ff_compiler_Syntax.PackageInfo(_c.package_,
|
|
227
|
+
return ff_compiler_Syntax.PackageInfo(_c.package_, [coreDependency_, ...info_.dependencies_], _c.includes_)
|
|
230
228
|
return
|
|
231
229
|
}
|
|
232
230
|
}
|
|
@@ -263,7 +261,7 @@ if(ff_core_Path.Path_exists(dependencyPath_, false, false, false)) {
|
|
|
263
261
|
ff_core_Path.Path_delete(dependencyPath_, 0, 100)
|
|
264
262
|
};
|
|
265
263
|
ff_core_Path.Path_createDirectory(dependencyPath_, true);
|
|
266
|
-
ff_core_Path.Path_writeStream(tarGzPath_, ff_core_List.List_toStream(
|
|
264
|
+
ff_core_Path.Path_writeStream(tarGzPath_, ff_core_List.List_toStream([buffer_], false), false);
|
|
267
265
|
ff_compiler_Dependencies.internalExtractTarGz_(tarGzPath_, dependencyPath_);
|
|
268
266
|
ff_core_Path.Path_renameTo(tarGzPath_, donePath_)
|
|
269
267
|
};
|
|
@@ -287,7 +285,7 @@ return packageInfo_
|
|
|
287
285
|
const newDependencies_ = ff_core_List.List_flatMap(packageInfos_, ((_w1) => {
|
|
288
286
|
return ff_compiler_Dependencies.Dependencies_processPackageInfo(self_, _w1)
|
|
289
287
|
}));
|
|
290
|
-
if(ff_core_Equal.notEquals_(newDependencies_,
|
|
288
|
+
if(ff_core_Equal.notEquals_(newDependencies_, [], ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_DDependency))) {
|
|
291
289
|
ff_compiler_Dependencies.Dependencies_processDependencies(self_, path_, httpClient_, newDependencies_)
|
|
292
290
|
}
|
|
293
291
|
}
|
|
@@ -325,7 +323,7 @@ const coreDependency_ = ff_compiler_Syntax.DDependency(info_.package_.at_, ff_co
|
|
|
325
323
|
const _1 = info_;
|
|
326
324
|
{
|
|
327
325
|
const _c = _1;
|
|
328
|
-
return ff_compiler_Syntax.PackageInfo(_c.package_,
|
|
326
|
+
return ff_compiler_Syntax.PackageInfo(_c.package_, [coreDependency_, ...info_.dependencies_], _c.includes_)
|
|
329
327
|
return
|
|
330
328
|
}
|
|
331
329
|
}
|
|
@@ -362,7 +360,7 @@ if((await ff_core_Path.Path_exists$(dependencyPath_, false, false, false, $task)
|
|
|
362
360
|
(await ff_core_Path.Path_delete$(dependencyPath_, 0, 100, $task))
|
|
363
361
|
};
|
|
364
362
|
(await ff_core_Path.Path_createDirectory$(dependencyPath_, true, $task));
|
|
365
|
-
(await ff_core_Path.Path_writeStream$(tarGzPath_, (await ff_core_List.List_toStream$(
|
|
363
|
+
(await ff_core_Path.Path_writeStream$(tarGzPath_, (await ff_core_List.List_toStream$([buffer_], false, $task)), false, $task));
|
|
366
364
|
(await ff_compiler_Dependencies.internalExtractTarGz_$(tarGzPath_, dependencyPath_, $task));
|
|
367
365
|
(await ff_core_Path.Path_renameTo$(tarGzPath_, donePath_, $task))
|
|
368
366
|
};
|
|
@@ -386,7 +384,7 @@ return packageInfo_
|
|
|
386
384
|
const newDependencies_ = (await ff_core_List.List_flatMap$(packageInfos_, (async (_w1, $task) => {
|
|
387
385
|
return (await ff_compiler_Dependencies.Dependencies_processPackageInfo$(self_, _w1, $task))
|
|
388
386
|
}), $task));
|
|
389
|
-
if(ff_core_Equal.notEquals_(newDependencies_,
|
|
387
|
+
if(ff_core_Equal.notEquals_(newDependencies_, [], ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_DDependency))) {
|
|
390
388
|
(await ff_compiler_Dependencies.Dependencies_processDependencies$(self_, path_, httpClient_, newDependencies_, $task))
|
|
391
389
|
}
|
|
392
390
|
}
|