firefly-compiler 0.4.27 → 0.4.28

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.
@@ -93,6 +93,7 @@ check(
93
93
  fireflyPath: Path
94
94
  path: Path
95
95
  mustContain: Option[String]
96
+ skipFiles: Set[String]
96
97
  virtualFiles: Map[String, String]
97
98
  cache: ModuleCache
98
99
  newVersion: Int
@@ -101,7 +102,7 @@ check(
101
102
  checkDependencies: Bool
102
103
  ): List[CompileError] {
103
104
  let packages = path.isDirectory().{
104
- | True => findPackageFiles(path, mustContain)
105
+ | True => findPackageFiles(path, mustContain, skipFiles)
105
106
  | False {path.endsWith([".firefly", "package.ff"])} => [PackageFiles(path.parent().grab(), Some(path), [])]
106
107
  | False => [PackageFiles(path.parent().grab(), None, [path])]
107
108
  }
@@ -156,8 +157,12 @@ capability PackageFiles(
156
157
  )
157
158
 
158
159
 
159
- findPackageFiles(path: Path, mustContain: Option[String]): List[PackageFiles] {
160
- let files = findFireflyFiles(path, mustContain)
160
+ findPackageFiles(
161
+ path: Path
162
+ mustContain: Option[String]
163
+ skipFiles: Set[String]
164
+ ): List[PackageFiles] {
165
+ let files = findFireflyFiles(path, mustContain, skipFiles)
161
166
  let split = files.partition {_.endsWith([".firefly", "package.ff"])}
162
167
  let packageFiles = split.first
163
168
  mutable singleFiles = split.second
@@ -174,17 +179,21 @@ findPackageFiles(path: Path, mustContain: Option[String]): List[PackageFiles] {
174
179
  [...multiFileProjects, ...singleFileProjects]
175
180
  }
176
181
 
177
- findFireflyFiles(path: Path, mustContain: Option[String]): List[Path] {
182
+ findFireflyFiles(
183
+ path: Path
184
+ mustContain: Option[String]
185
+ skipFiles: Set[String]
186
+ ): List[Path] {
178
187
  let split = path.entries().toList().partition {_.isDirectory()}
179
188
  let directories = split.first.map {_.path()}.filter {_.base().all {c =>
180
189
  c == '.' || c.isAsciiLower() || c.isAsciiDigit()
181
190
  }}
182
191
  let fireflyFiles = split.second.map {_.path()}.filter {file =>
183
- file.extension() == ".ff" && mustContain.all {s =>
192
+ file.extension() == ".ff" && !skipFiles.contains(file.absolute()) && mustContain.all {s =>
184
193
  file.readText().contains(s)
185
194
  }
186
195
  }
187
- [...fireflyFiles, ...directories.flatMap {findFireflyFiles(_, mustContain)}]
196
+ [...fireflyFiles, ...directories.flatMap {findFireflyFiles(_, mustContain, skipFiles)}]
188
197
  }
189
198
 
190
199
  internalCreateExecutable(
package/compiler/Main.ff CHANGED
@@ -92,6 +92,7 @@ main(system: NodeSystem): Unit {
92
92
  fireflyPath = fireflyPath
93
93
  path = system.path(filePath)
94
94
  mustContain = None
95
+ skipFiles = Set.empty()
95
96
  virtualFiles = Map.empty()
96
97
  cache = ModuleCache.empty(1)
97
98
  newVersion = 0
@@ -22,9 +22,8 @@ empty(version: Int): ModuleCache {
22
22
 
23
23
  extend self: ModuleCache {
24
24
 
25
- remove(paths: List[Path]) {
26
- if(!paths.isEmpty()):
27
- let keys = paths.map {_.absolute()}
25
+ remove(keys: List[String]) {
26
+ if(!keys.isEmpty()):
28
27
  self.parsedModules = self.parsedModules.removeList(keys)
29
28
  self.resolvedModules = self.resolvedModules.removeList(keys)
30
29
  self.derivedModules = self.derivedModules.removeList(keys)
@@ -32,6 +31,25 @@ extend self: ModuleCache {
32
31
  self.emittedModules = self.emittedModules.removeList(keys)
33
32
  }
34
33
 
34
+ invalidate(key: String) {
35
+ //Log.trace("Invalidate: " + uri)
36
+ self.parsedModules.get(key).each: | Pair(module, _) =>
37
+ let moduleName = module.file.dropLast(3)
38
+ self.remove([key])
39
+ self.parsedModules.each {| k, Pair(m, _) =>
40
+ if(m.imports.any {i => i.package == module.packagePair && i.file == moduleName}) {
41
+ //Log.trace("Invalidating due to import of invalidated module: " + m.packagePair.groupName() + "/" + m.file)
42
+ self.remove([k])
43
+ }
44
+ }
45
+ }
46
+
47
+ filesNotImporting(packagePair: PackagePair, moduleName: String): List[String] {
48
+ self.parsedModules.toList().collect {| Pair(k, Pair(m, _)) =>
49
+ if(!m.imports.any {i => i.package == packagePair && i.file == moduleName}): k
50
+ }
51
+ }
52
+
35
53
  without(newVersion: Int, path: Path): ModuleCache {
36
54
  let key = path.absolute()
37
55
  if(path.isFile()) {
@@ -157,4 +175,4 @@ modulePath(
157
175
  }
158
176
  let file = moduleName + ".ff"
159
177
  packagePath.slash(file)
160
- }
178
+ }
package/lsp/Handler.ff CHANGED
@@ -211,7 +211,7 @@ extend self: Handler {
211
211
  let uri = parameters.grab("textDocument").field("uri").grabString()
212
212
  let path = system.pathFromUrl(uri)
213
213
  let fireflyPath = system.path(".")
214
- let errors = self.check(system, fireflyPath, path, None, self.virtualFiles, version, LspHook.disabled(), True)
214
+ let errors = self.check(system, fireflyPath, path, None, Set.empty(), self.virtualFiles, version, LspHook.disabled(), True)
215
215
  let diagnostics = errors.map {| CompileError(at, message) =>
216
216
  let tokenLocation = self.findToken(system, at)
217
217
  Json.object()
@@ -230,7 +230,7 @@ extend self: Handler {
230
230
  let uri = parameters.grab("textDocument").field("uri").grabString()
231
231
  let path = system.pathFromUrl(uri)
232
232
  let fireflyPath = system.path(".")
233
- let errors = self.check(system, fireflyPath, path, None, self.virtualFiles, version, LspHook.disabled(), True)
233
+ let errors = self.check(system, fireflyPath, path, None, Set.empty(), self.virtualFiles, version, LspHook.disabled(), True)
234
234
  let diagnostics = errors.map {| CompileError(at, message) =>
235
235
  let tokenLocation = self.findToken(system, at)
236
236
  Json.object()
@@ -295,7 +295,7 @@ extend self: Handler {
295
295
 
296
296
  handleWorkspaceSymbol(system: NodeSystem, parameters: Map[String, Json]): ResultOrError {
297
297
  let query = parameters.grab("query").grabString()
298
- let files = self.printTime(system.mainTask(), "findFireflyFiles") {Builder.findFireflyFiles(self.rootPath.grab(), None)}
298
+ let files = self.printTime(system.mainTask(), "findFireflyFiles") {Builder.findFireflyFiles(self.rootPath.grab(), None, Set.empty())}
299
299
  let symbols = files.flatMap {file =>
300
300
  let documentSymbols = self.getDocumentSymbolsWithCache(system, file)
301
301
  let workspaceSymbols = documentSymbols.flatMap {SymbolHandler.documentToWorkspaceSymbols(_, None)}
@@ -314,9 +314,9 @@ extend self: Handler {
314
314
  let creates = parameters.grab("changes").grabArray().filter {_.field("type").grabInt() == 1}
315
315
  let changes = parameters.grab("changes").grabArray().filter {_.field("type").grabInt() == 2}
316
316
  let deletes = parameters.grab("changes").grabArray().filter {_.field("type").grabInt() == 3}
317
- self.moduleCache.remove(creates.map {_.field("uri").grabString()}.map {system.pathFromUrl(_)})
318
- self.moduleCache.remove(changes.map {_.field("uri").grabString()}.map {system.pathFromUrl(_)})
319
- self.moduleCache.remove(deletes.map {_.field("uri").grabString()}.map {system.pathFromUrl(_)})
317
+ creates.map {_.field("uri").grabString()}.each {self.moduleCache.invalidate(system.pathFromUrl(_).absolute())}
318
+ changes.map {_.field("uri").grabString()}.each {self.moduleCache.invalidate(system.pathFromUrl(_).absolute())}
319
+ deletes.map {_.field("uri").grabString()}.each {self.moduleCache.invalidate(system.pathFromUrl(_).absolute())}
320
320
  let diagnostics = self.handleClearDiagnostic(system, [Pair("files", Json.array(deletes))].toMap())
321
321
  diagnostics.map {Pair("textDocument/publishDiagnostics", _)}
322
322
  }
@@ -326,6 +326,7 @@ extend self: Handler {
326
326
  let path = system.pathFromUrl(uri)
327
327
  self.responseCache = Map.empty()
328
328
  self.fileSymbolsCache = self.fileSymbolsCache.remove(path.absolute())
329
+ self.moduleCache.invalidate(path.absolute())
329
330
  let contentChanges = parameters.grab("contentChanges").grabArray()
330
331
  if(contentChanges.size() != 1) {throw(LanguageServerException("Expected a single element in contentChanges"))} else:
331
332
  let contentChange = contentChanges.grab(0)
@@ -343,7 +344,7 @@ extend self: Handler {
343
344
  handleHover(system: NodeSystem, targetAt: Location, goToDefinition: Bool, version: Int): ResultOrError {
344
345
  let lspHook = LspHook.make(at = Some(targetAt), definedAt = None, insertIdentifier = False, trackSymbols = False)
345
346
  let path = system.path(targetAt.file)
346
- let errors = self.check(system, self.fireflyPath, path, None, self.virtualFiles, version, lspHook, True)
347
+ let errors = self.check(system, self.fireflyPath, path, None, Set.empty(), self.virtualFiles, version, lspHook, True)
347
348
  errors.each {| CompileError(at, message) =>
348
349
  Log.trace("handleHover check error: " + message)
349
350
  }
@@ -365,7 +366,7 @@ extend self: Handler {
365
366
  )
366
367
  let lspHook = LspHook.make(at = Some(completionAt), definedAt = None, insertIdentifier = True, trackSymbols = False)
367
368
  let path = system.path(completionAt.file)
368
- let errors = self.check(system, self.fireflyPath, path, None, self.virtualFiles, version, lspHook, True)
369
+ let errors = self.check(system, self.fireflyPath, path, None, Set.empty(), self.virtualFiles, version, lspHook, True)
369
370
  errors.each {| CompileError(at, message) =>
370
371
  Log.trace("handleCompletion check error: " + message)
371
372
  }
@@ -399,7 +400,7 @@ extend self: Handler {
399
400
  | ParseArgumentHook h =>
400
401
  let callLspHook = LspHook.make(at = Some(h.callAt), definedAt = None, insertIdentifier = False, trackSymbols = False)
401
402
  let path = system.path(cursorAt.file)
402
- let errors = self.check(system, self.fireflyPath, path, None, self.virtualFiles, version, callLspHook, True)
403
+ let errors = self.check(system, self.fireflyPath, path, None, Set.empty(), self.virtualFiles, version, callLspHook, True)
403
404
  errors.each {| CompileError(at, message) =>
404
405
  Log.trace("handleSignatureHelp check 2 error: " + message)
405
406
  }
@@ -464,7 +465,7 @@ extend self: Handler {
464
465
  ): Option[List[TokenLocation]] {
465
466
  let temporaryLspHook = LspHook.make(at = Some(targetAt), definedAt = None, insertIdentifier = False, trackSymbols = False)
466
467
  let path = system.path(targetAt.file)
467
- let errors = self.check(system, self.fireflyPath, path, None, self.virtualFiles, version, temporaryLspHook, True)
468
+ let errors = self.check(system, self.fireflyPath, path, None, Set.empty(), self.virtualFiles, version, temporaryLspHook, True)
468
469
  errors.each {| CompileError(at, message) =>
469
470
  Log.trace("findReferences first check error: " + message + " in " + at.file + ":" + at.line + ":" + at.column)
470
471
  }
@@ -496,6 +497,16 @@ extend self: Handler {
496
497
  qualifiedName.split('.').grabLast().split('_').grabLast()
497
498
  }
498
499
 
500
+ function extractModuleName(qualifiedName: String): String {
501
+ qualifiedName.split('/').grabLast().takeWhile {c => c != '.' || c == '_'}
502
+ }
503
+
504
+ function extractPackagePair(qualifiedName: String): PackagePair {
505
+ let group = qualifiedName.split(':').grabFirst()
506
+ let name = qualifiedName.split(':').grabLast().takeWhile {_ != '/'}
507
+ PackagePair(group, name)
508
+ }
509
+
499
510
  definedAtList.first().{
500
511
  | Some(definition) =>
501
512
  let lspHook = LspHook.make(at = None, definedAt = Some(definition.at), insertIdentifier = False, trackSymbols = False)
@@ -505,7 +516,19 @@ extend self: Handler {
505
516
  Log.trace("findReferences definition: " + Show.show(definition))
506
517
  mustContain.each {Log.trace("mustContain: " + _)}
507
518
 
508
- let errors = self.check(system, self.fireflyPath, path, mustContain, self.virtualFiles, version, lspHook, True, False)
519
+ let skipFiles = if(definition.name.contains(":")) {
520
+ let list = self.moduleCache.filesNotImporting(extractPackagePair(definition.name), extractModuleName(definition.name))
521
+ list.toSet()
522
+ } else {
523
+ self.moduleCache.parsedModules.get(definition.at.file).map {| Pair(module, _) =>
524
+ let list = self.moduleCache.filesNotImporting(module.packagePair, module.file.dropLast(3))
525
+ list.toSet()
526
+ }.else {
527
+ Log.trace("No skip list due to unqualified definition.name: " + definition.name)
528
+ Set.empty()
529
+ }
530
+ }
531
+ let errors = self.check(system, self.fireflyPath, path, mustContain, skipFiles, self.virtualFiles, version, lspHook, True, False)
509
532
  errors.each {| CompileError(at, message) =>
510
533
  Log.trace("findReferences second check error: " + message + " in " + at.file + ":" + at.line + ":" + at.column)
511
534
  }
@@ -646,6 +669,7 @@ extend self: Handler {
646
669
  fireflyPath: Path
647
670
  path: Path
648
671
  mustContain: Option[String]
672
+ skipFiles: Set[String]
649
673
  virtualFiles: Map[String, String]
650
674
  newModuleCacheVersion: Int
651
675
  lspHook: LspHook
@@ -657,6 +681,7 @@ extend self: Handler {
657
681
  fireflyPath
658
682
  path
659
683
  mustContain
684
+ skipFiles
660
685
  virtualFiles
661
686
  self.moduleCache
662
687
  newModuleCacheVersion
@@ -166,10 +166,10 @@ return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.pac
166
166
  }))(resolvedDependencies_), ff_core_Option.None(), ff_core_NodeSystem.NodeSystem_path(system_, ".firefly/temporary"), ff_core_Path.Path_slash(ff_core_NodeSystem.NodeSystem_path(system_, ".firefly/output"), target_), false, ff_compiler_ModuleCache.empty_(0))
167
167
  }
168
168
 
169
- export function check_(system_, fireflyPath_, path_, mustContain_, virtualFiles_, cache_, newVersion_, lspHook_, infer_, checkDependencies_) {
169
+ export function check_(system_, fireflyPath_, path_, mustContain_, skipFiles_, virtualFiles_, cache_, newVersion_, lspHook_, infer_, checkDependencies_) {
170
170
  const packages_ = (((_1) => {
171
171
  if(_1) {
172
- return ff_compiler_Builder.findPackageFiles_(path_, mustContain_)
172
+ return ff_compiler_Builder.findPackageFiles_(path_, mustContain_, skipFiles_)
173
173
  }
174
174
  if(!_1 && ff_core_Path.Path_endsWith(path_, [".firefly", "package.ff"])) {
175
175
  return [ff_compiler_Builder.PackageFiles(ff_core_Option.Option_grab(ff_core_Path.Path_parent(path_)), ff_core_Option.Some(path_), [])]
@@ -221,8 +221,8 @@ ff_compiler_ModuleCache.ModuleCache_mergeVersions(cache_, compiler_.cache_)
221
221
  return ff_core_Array.Array_drain(errors_)
222
222
  }
223
223
 
224
- export function findPackageFiles_(path_, mustContain_) {
225
- const files_ = ff_compiler_Builder.findFireflyFiles_(path_, mustContain_);
224
+ export function findPackageFiles_(path_, mustContain_, skipFiles_) {
225
+ const files_ = ff_compiler_Builder.findFireflyFiles_(path_, mustContain_, skipFiles_);
226
226
  const split_ = ff_core_List.List_partition(files_, ((_w1) => {
227
227
  return ff_core_Path.Path_endsWith(_w1, [".firefly", "package.ff"])
228
228
  }));
@@ -243,7 +243,7 @@ return ff_compiler_Builder.PackageFiles(projectRoot_, ff_core_Option.None(), [fi
243
243
  return [...multiFileProjects_, ...singleFileProjects_]
244
244
  }
245
245
 
246
- export function findFireflyFiles_(path_, mustContain_) {
246
+ export function findFireflyFiles_(path_, mustContain_, skipFiles_) {
247
247
  const split_ = ff_core_List.List_partition(ff_core_Stream.Stream_toList(ff_core_Path.Path_entries(path_)), ((_w1) => {
248
248
  return ff_core_Path.PathEntry_isDirectory(_w1)
249
249
  }));
@@ -257,12 +257,12 @@ return (((c_ === 46) || ff_core_Char.Char_isAsciiLower(c_)) || ff_core_Char.Char
257
257
  const fireflyFiles_ = ff_core_List.List_filter(ff_core_List.List_map(split_.second_, ((_w1) => {
258
258
  return ff_core_Path.PathEntry_path(_w1)
259
259
  })), ((file_) => {
260
- return ((ff_core_Path.Path_extension(file_) === ".ff") && ff_core_Option.Option_all(mustContain_, ((s_) => {
260
+ return (((ff_core_Path.Path_extension(file_) === ".ff") && (!ff_core_Set.Set_contains(skipFiles_, ff_core_Path.Path_absolute(file_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))) && ff_core_Option.Option_all(mustContain_, ((s_) => {
261
261
  return ff_core_String.String_contains(ff_core_Path.Path_readText(file_), s_)
262
262
  })))
263
263
  }));
264
264
  return [...fireflyFiles_, ...ff_core_List.List_flatMap(directories_, ((_w1) => {
265
- return ff_compiler_Builder.findFireflyFiles_(_w1, mustContain_)
265
+ return ff_compiler_Builder.findFireflyFiles_(_w1, mustContain_, skipFiles_)
266
266
  }))]
267
267
  }
268
268
 
@@ -355,10 +355,10 @@ return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.pac
355
355
  }))(resolvedDependencies_), ff_core_Option.None(), (await ff_core_NodeSystem.NodeSystem_path$(system_, ".firefly/temporary", $task)), (await ff_core_Path.Path_slash$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".firefly/output", $task)), target_, $task)), false, ff_compiler_ModuleCache.empty_(0), $task))
356
356
  }
357
357
 
358
- export async function check_$(system_, fireflyPath_, path_, mustContain_, virtualFiles_, cache_, newVersion_, lspHook_, infer_, checkDependencies_, $task) {
358
+ export async function check_$(system_, fireflyPath_, path_, mustContain_, skipFiles_, virtualFiles_, cache_, newVersion_, lspHook_, infer_, checkDependencies_, $task) {
359
359
  const packages_ = (await ((async (_1, $task) => {
360
360
  if(_1) {
361
- return (await ff_compiler_Builder.findPackageFiles_$(path_, mustContain_, $task))
361
+ return (await ff_compiler_Builder.findPackageFiles_$(path_, mustContain_, skipFiles_, $task))
362
362
  }
363
363
  if(!_1 && (await ff_core_Path.Path_endsWith$(path_, [".firefly", "package.ff"], $task))) {
364
364
  return [ff_compiler_Builder.PackageFiles(ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(path_, $task))), ff_core_Option.Some(path_), [])]
@@ -410,8 +410,8 @@ ff_compiler_ModuleCache.ModuleCache_mergeVersions(cache_, compiler_.cache_)
410
410
  return ff_core_Array.Array_drain(errors_)
411
411
  }
412
412
 
413
- export async function findPackageFiles_$(path_, mustContain_, $task) {
414
- const files_ = (await ff_compiler_Builder.findFireflyFiles_$(path_, mustContain_, $task));
413
+ export async function findPackageFiles_$(path_, mustContain_, skipFiles_, $task) {
414
+ const files_ = (await ff_compiler_Builder.findFireflyFiles_$(path_, mustContain_, skipFiles_, $task));
415
415
  const split_ = (await ff_core_List.List_partition$(files_, (async (_w1, $task) => {
416
416
  return (await ff_core_Path.Path_endsWith$(_w1, [".firefly", "package.ff"], $task))
417
417
  }), $task));
@@ -432,7 +432,7 @@ return ff_compiler_Builder.PackageFiles(projectRoot_, ff_core_Option.None(), [fi
432
432
  return [...multiFileProjects_, ...singleFileProjects_]
433
433
  }
434
434
 
435
- export async function findFireflyFiles_$(path_, mustContain_, $task) {
435
+ export async function findFireflyFiles_$(path_, mustContain_, skipFiles_, $task) {
436
436
  const split_ = (await ff_core_List.List_partition$((await ff_core_Stream.Stream_toList$((await ff_core_Path.Path_entries$(path_, $task)), $task)), (async (_w1, $task) => {
437
437
  return (await ff_core_Path.PathEntry_isDirectory$(_w1, $task))
438
438
  }), $task));
@@ -446,12 +446,12 @@ return (((c_ === 46) || ff_core_Char.Char_isAsciiLower(c_)) || ff_core_Char.Char
446
446
  const fireflyFiles_ = (await ff_core_List.List_filter$((await ff_core_List.List_map$(split_.second_, (async (_w1, $task) => {
447
447
  return (await ff_core_Path.PathEntry_path$(_w1, $task))
448
448
  }), $task)), (async (file_, $task) => {
449
- return (((await ff_core_Path.Path_extension$(file_, $task)) === ".ff") && (await ff_core_Option.Option_all$(mustContain_, (async (s_, $task) => {
449
+ return ((((await ff_core_Path.Path_extension$(file_, $task)) === ".ff") && (!ff_core_Set.Set_contains(skipFiles_, (await ff_core_Path.Path_absolute$(file_, $task)), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))) && (await ff_core_Option.Option_all$(mustContain_, (async (s_, $task) => {
450
450
  return ff_core_String.String_contains((await ff_core_Path.Path_readText$(file_, $task)), s_)
451
451
  }), $task)))
452
452
  }), $task));
453
453
  return [...fireflyFiles_, ...(await ff_core_List.List_flatMap$(directories_, (async (_w1, $task) => {
454
- return (await ff_compiler_Builder.findFireflyFiles_$(_w1, mustContain_, $task))
454
+ return (await ff_compiler_Builder.findFireflyFiles_$(_w1, mustContain_, skipFiles_, $task))
455
455
  }), $task))]
456
456
  }
457
457
 
@@ -212,7 +212,7 @@ return
212
212
  }
213
213
  if(command_a.CheckCommand) {
214
214
  const filePath_ = command_a.filePath_;
215
- const errors_ = ff_compiler_Builder.check_(system_, fireflyPath_, ff_core_NodeSystem.NodeSystem_path(system_, filePath_), ff_core_Option.None(), ff_core_Map.empty_(), ff_compiler_ModuleCache.empty_(1), 0, ff_compiler_LspHook.disabled_(), true, false);
215
+ const errors_ = ff_compiler_Builder.check_(system_, fireflyPath_, ff_core_NodeSystem.NodeSystem_path(system_, filePath_), ff_core_Option.None(), ff_core_Set.empty_(), ff_core_Map.empty_(), ff_compiler_ModuleCache.empty_(1), 0, ff_compiler_LspHook.disabled_(), true, false);
216
216
  if((!ff_core_List.List_isEmpty(errors_))) {
217
217
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(ff_core_List.List_distinct(errors_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_CompileError)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
218
218
  }
@@ -459,7 +459,7 @@ return
459
459
  }
460
460
  if(command_a.CheckCommand) {
461
461
  const filePath_ = command_a.filePath_;
462
- const errors_ = (await ff_compiler_Builder.check_$(system_, fireflyPath_, (await ff_core_NodeSystem.NodeSystem_path$(system_, filePath_, $task)), ff_core_Option.None(), ff_core_Map.empty_(), ff_compiler_ModuleCache.empty_(1), 0, ff_compiler_LspHook.disabled_(), true, false, $task));
462
+ const errors_ = (await ff_compiler_Builder.check_$(system_, fireflyPath_, (await ff_core_NodeSystem.NodeSystem_path$(system_, filePath_, $task)), ff_core_Option.None(), ff_core_Set.empty_(), ff_core_Map.empty_(), ff_compiler_ModuleCache.empty_(1), 0, ff_compiler_LspHook.disabled_(), true, false, $task));
463
463
  if((!ff_core_List.List_isEmpty(errors_))) {
464
464
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileErrors(ff_core_List.List_distinct(errors_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_CompileError)), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileErrors)})
465
465
  }
@@ -147,11 +147,8 @@ const file_ = (moduleName_ + ".ff");
147
147
  return (await ff_core_Path.Path_slash$(packagePath_, file_, $task))
148
148
  }
149
149
 
150
- export function ModuleCache_remove(self_, paths_) {
151
- if((!ff_core_List.List_isEmpty(paths_))) {
152
- const keys_ = ff_core_List.List_map(paths_, ((_w1) => {
153
- return ff_core_Path.Path_absolute(_w1)
154
- }));
150
+ export function ModuleCache_remove(self_, keys_) {
151
+ if((!ff_core_List.List_isEmpty(keys_))) {
155
152
  self_.parsedModules_ = ff_core_Map.Map_removeList(self_.parsedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
156
153
  self_.resolvedModules_ = ff_core_Map.Map_removeList(self_.resolvedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
157
154
  self_.derivedModules_ = ff_core_Map.Map_removeList(self_.derivedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
@@ -160,6 +157,44 @@ self_.emittedModules_ = ff_core_Map.Map_removeList(self_.emittedModules_, keys_,
160
157
  }
161
158
  }
162
159
 
160
+ export function ModuleCache_invalidate(self_, key_) {
161
+ ff_core_Option.Option_each(ff_core_Map.Map_get(self_.parsedModules_, key_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
162
+ {
163
+ const module_ = _1.first_;
164
+ const moduleName_ = ff_core_String.String_dropLast(module_.file_, 3);
165
+ ff_compiler_ModuleCache.ModuleCache_remove(self_, [key_]);
166
+ ff_core_Map.Map_each(self_.parsedModules_, ((_1, _2) => {
167
+ {
168
+ const k_ = _1;
169
+ const m_ = _2.first_;
170
+ if(ff_core_List.List_any(m_.imports_, ((i_) => {
171
+ return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(i_.package_, module_.packagePair_) && (i_.file_ === moduleName_))
172
+ }))) {
173
+ ff_compiler_ModuleCache.ModuleCache_remove(self_, [k_])
174
+ }
175
+ return
176
+ }
177
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
178
+ return
179
+ }
180
+ }))
181
+ }
182
+
183
+ export function ModuleCache_filesNotImporting(self_, packagePair_, moduleName_) {
184
+ return ff_core_List.List_collect(ff_core_Map.Map_toList(self_.parsedModules_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
185
+ {
186
+ const k_ = _1.first_;
187
+ const m_ = _1.second_.first_;
188
+ if((!ff_core_List.List_any(m_.imports_, ((i_) => {
189
+ return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(i_.package_, packagePair_) && (i_.file_ === moduleName_))
190
+ })))) {
191
+ return ff_core_Option.Some(k_)
192
+ } else return ff_core_Option.None()
193
+ return
194
+ }
195
+ }))
196
+ }
197
+
163
198
  export function ModuleCache_without(self_, newVersion_, path_) {
164
199
  const key_ = ff_core_Path.Path_absolute(path_);
165
200
  if(ff_core_Path.Path_isFile(path_)) {
@@ -285,11 +320,8 @@ ff_core_Error.Error_rethrow(error_)
285
320
  }
286
321
  }
287
322
 
288
- export async function ModuleCache_remove$(self_, paths_, $task) {
289
- if((!ff_core_List.List_isEmpty(paths_))) {
290
- const keys_ = (await ff_core_List.List_map$(paths_, (async (_w1, $task) => {
291
- return (await ff_core_Path.Path_absolute$(_w1, $task))
292
- }), $task));
323
+ export async function ModuleCache_remove$(self_, keys_, $task) {
324
+ if((!ff_core_List.List_isEmpty(keys_))) {
293
325
  self_.parsedModules_ = ff_core_Map.Map_removeList(self_.parsedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
294
326
  self_.resolvedModules_ = ff_core_Map.Map_removeList(self_.resolvedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
295
327
  self_.derivedModules_ = ff_core_Map.Map_removeList(self_.derivedModules_, keys_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
@@ -298,6 +330,44 @@ self_.emittedModules_ = ff_core_Map.Map_removeList(self_.emittedModules_, keys_,
298
330
  }
299
331
  }
300
332
 
333
+ export async function ModuleCache_invalidate$(self_, key_, $task) {
334
+ ff_core_Option.Option_each(ff_core_Map.Map_get(self_.parsedModules_, key_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
335
+ {
336
+ const module_ = _1.first_;
337
+ const moduleName_ = ff_core_String.String_dropLast(module_.file_, 3);
338
+ ff_compiler_ModuleCache.ModuleCache_remove(self_, [key_]);
339
+ ff_core_Map.Map_each(self_.parsedModules_, ((_1, _2) => {
340
+ {
341
+ const k_ = _1;
342
+ const m_ = _2.first_;
343
+ if(ff_core_List.List_any(m_.imports_, ((i_) => {
344
+ return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(i_.package_, module_.packagePair_) && (i_.file_ === moduleName_))
345
+ }))) {
346
+ ff_compiler_ModuleCache.ModuleCache_remove(self_, [k_])
347
+ }
348
+ return
349
+ }
350
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
351
+ return
352
+ }
353
+ }))
354
+ }
355
+
356
+ export async function ModuleCache_filesNotImporting$(self_, packagePair_, moduleName_, $task) {
357
+ return ff_core_List.List_collect(ff_core_Map.Map_toList(self_.parsedModules_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
358
+ {
359
+ const k_ = _1.first_;
360
+ const m_ = _1.second_.first_;
361
+ if((!ff_core_List.List_any(m_.imports_, ((i_) => {
362
+ return (ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_PackagePair.equals_(i_.package_, packagePair_) && (i_.file_ === moduleName_))
363
+ })))) {
364
+ return ff_core_Option.Some(k_)
365
+ } else return ff_core_Option.None()
366
+ return
367
+ }
368
+ }))
369
+ }
370
+
301
371
  export async function ModuleCache_without$(self_, newVersion_, path_, $task) {
302
372
  const key_ = (await ff_core_Path.Path_absolute$(path_, $task));
303
373
  if((await ff_core_Path.Path_isFile$(path_, $task))) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly compiler",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.4.27",
7
+ "version": "0.4.28",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -37,6 +37,20 @@
37
37
  "decreaseIndentPattern": "^((?!.*?\\/\\*).*\\*/)?\\s*[\\)\\}\\]|].*$"
38
38
  },
39
39
  "onEnterRules": [
40
+ {
41
+ "beforeText": "\\.{\\s*$",
42
+ "action": {
43
+ "appendText": "| ",
44
+ "indent": "indent"
45
+ }
46
+ },
47
+ {
48
+ "beforeText": "^\\s*",
49
+ "afterText": "\\s*\\|",
50
+ "action": {
51
+ "indent": "none"
52
+ }
53
+ },
40
54
  {
41
55
  "beforeText": "({|=>)\\s*$",
42
56
  "afterText": "^\\s*}",
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly language support",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.4.27",
7
+ "version": "0.4.28",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"