firefly-compiler 0.4.19 → 0.4.21
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 +23 -13
- package/compiler/JsEmitter.ff +120 -76
- package/compiler/LspHook.ff +17 -3
- package/compiler/Main.ff +13 -7
- package/compiler/Parser.ff +11 -13
- package/compiler/Resolver.ff +15 -15
- package/compiler/Syntax.ff +1 -0
- package/core/Array.ff +6 -4
- package/core/Int.ff +12 -12
- package/core/Json.ff +2 -2
- package/core/List.ff +6 -4
- package/experimental/benchmarks/ListGrab.ff +23 -0
- package/experimental/benchmarks/ListGrab.java +55 -0
- package/experimental/benchmarks/Pyrotek45.ff +30 -0
- package/experimental/benchmarks/Pyrotek45.java +64 -0
- package/experimental/tests/TestJson.ff +26 -0
- package/lsp/CompletionHandler.ff +14 -14
- package/lsp/Handler.ff +56 -60
- package/lsp/SignatureHelpHandler.ff +5 -4
- package/lsp/SymbolHandler.ff +18 -4
- package/lsp/TestReferences.ff +15 -0
- package/lsp/TestReferencesCase.ff +8 -0
- package/output/js/ff/compiler/Builder.mjs +50 -44
- package/output/js/ff/compiler/Dependencies.mjs +0 -2
- package/output/js/ff/compiler/Deriver.mjs +16 -140
- package/output/js/ff/compiler/Dictionaries.mjs +8 -222
- package/output/js/ff/compiler/Environment.mjs +12 -154
- package/output/js/ff/compiler/Inference.mjs +127 -1013
- package/output/js/ff/compiler/JsEmitter.mjs +434 -2344
- package/output/js/ff/compiler/JsImporter.mjs +0 -12
- package/output/js/ff/compiler/LspHook.mjs +548 -151
- package/output/js/ff/compiler/Main.mjs +96 -550
- package/output/js/ff/compiler/Parser.mjs +58 -390
- package/output/js/ff/compiler/Patterns.mjs +20 -200
- package/output/js/ff/compiler/Resolver.mjs +26 -340
- package/output/js/ff/compiler/Substitution.mjs +2 -160
- package/output/js/ff/compiler/Syntax.mjs +449 -3293
- package/output/js/ff/compiler/Token.mjs +9 -1095
- package/output/js/ff/compiler/Tokenizer.mjs +4 -2
- package/output/js/ff/compiler/Unification.mjs +26 -360
- package/output/js/ff/compiler/Wildcards.mjs +0 -86
- package/output/js/ff/compiler/Workspace.mjs +8 -96
- package/output/js/ff/core/Array.mjs +15 -8
- package/output/js/ff/core/AssetSystem.mjs +4 -14
- package/output/js/ff/core/Bool.mjs +0 -12
- package/output/js/ff/core/Core.mjs +0 -30
- package/output/js/ff/core/Int.mjs +24 -24
- package/output/js/ff/core/IntMap.mjs +0 -8
- package/output/js/ff/core/Json.mjs +2 -42
- package/output/js/ff/core/List.mjs +23 -32
- package/output/js/ff/core/Lock.mjs +0 -10
- package/output/js/ff/core/Map.mjs +0 -24
- package/output/js/ff/core/Option.mjs +10 -286
- package/output/js/ff/core/Ordering.mjs +16 -158
- package/output/js/ff/core/Pair.mjs +2 -34
- package/output/js/ff/core/Path.mjs +2 -28
- package/output/js/ff/core/Random.mjs +4 -4
- package/output/js/ff/core/RbMap.mjs +56 -644
- package/output/js/ff/core/Show.mjs +0 -16
- package/output/js/ff/core/Stream.mjs +14 -144
- package/output/js/ff/core/StringMap.mjs +0 -8
- package/output/js/ff/core/Try.mjs +4 -108
- package/output/js/ff/core/Unit.mjs +2 -16
- package/package.json +1 -1
- package/postgresql/Pg.ff +23 -23
- package/vscode/client/src/extension.ts +30 -2
- package/vscode/package.json +17 -1
- package/core/Stack.ff +0 -250
package/core/Stack.ff
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
class Array[T] {}
|
|
2
|
-
|
|
3
|
-
make[T](): Array[T]
|
|
4
|
-
target js sync "return {array: []}"
|
|
5
|
-
|
|
6
|
-
fill[T](size: Int, value: T): List[T]
|
|
7
|
-
target js sync """
|
|
8
|
-
return {array: new Array(size_).fill(value_)};
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
fillBy[T](size: Int, body: Int => T): List[T]
|
|
12
|
-
target js sync """
|
|
13
|
-
return {array: Array.from({length: size_}, (_, i) => body_(i))};
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
range(size: Int): List[Int]
|
|
17
|
-
target js sync """
|
|
18
|
-
return {array: Array.from({length: size_}, (_, i) => i)};
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
extend self[T]: Array[T] {
|
|
22
|
-
|
|
23
|
-
isEmpty(): Bool
|
|
24
|
-
target js sync "return self_.array.length === 0"
|
|
25
|
-
|
|
26
|
-
size(): Int
|
|
27
|
-
target js sync "return self_.array.length"
|
|
28
|
-
|
|
29
|
-
get(index: Int): Option[T]
|
|
30
|
-
target js sync """
|
|
31
|
-
return index_ >= 0 && index_ < self_.array.length
|
|
32
|
-
? ff_core_Option.Some(self_.array[index_])
|
|
33
|
-
: ff_core_Option.None()
|
|
34
|
-
"""
|
|
35
|
-
|
|
36
|
-
grab(index: Int): T
|
|
37
|
-
target js sync """
|
|
38
|
-
if(index_ < 0 || index_ >= self_.array.length) {
|
|
39
|
-
ff_core_Try.internalThrowGrabException_()
|
|
40
|
-
}
|
|
41
|
-
return self_.array[index_]
|
|
42
|
-
"""
|
|
43
|
-
|
|
44
|
-
grabFirst(): T {self.grab(0)}
|
|
45
|
-
|
|
46
|
-
grabLast(): T {self.grab(self.size() - 1)}
|
|
47
|
-
|
|
48
|
-
first(): Option[T]
|
|
49
|
-
target js sync """
|
|
50
|
-
return self_.array.length > 0
|
|
51
|
-
? ff_core_Option.Some(self_.array[0])
|
|
52
|
-
: ff_core_Option.None()
|
|
53
|
-
"""
|
|
54
|
-
|
|
55
|
-
last(): Option[T]
|
|
56
|
-
target js sync """
|
|
57
|
-
return self_.array.length > 0
|
|
58
|
-
? ff_core_Option.Some(self_.array[self_.array.length - 1])
|
|
59
|
-
: ff_core_Option.None()
|
|
60
|
-
"""
|
|
61
|
-
|
|
62
|
-
push(value: T): Unit
|
|
63
|
-
target js sync "self_.array.push(value_)"
|
|
64
|
-
|
|
65
|
-
pushArray(value: Array[T]): Unit
|
|
66
|
-
target js sync "self_.array.push(...value_.array)"
|
|
67
|
-
|
|
68
|
-
pushList(value: List[T]): Unit
|
|
69
|
-
target js sync "self_.array.push(...value_)"
|
|
70
|
-
|
|
71
|
-
pop(): Option[T]
|
|
72
|
-
target js sync """
|
|
73
|
-
return self_.array.length > 0
|
|
74
|
-
? ff_core_Option.Some(self_.array.pop())
|
|
75
|
-
: ff_core_Option.None()
|
|
76
|
-
"""
|
|
77
|
-
|
|
78
|
-
set(index: Int, value: T): Unit
|
|
79
|
-
target js sync """
|
|
80
|
-
if(index_ < 0 || index_ > self_.array.length) {
|
|
81
|
-
ff_core_Try.internalThrowGrabException_()
|
|
82
|
-
}
|
|
83
|
-
self_.array[index_] = value_
|
|
84
|
-
"""
|
|
85
|
-
|
|
86
|
-
modify(index: Int, body: T => T): Unit
|
|
87
|
-
target js sync """
|
|
88
|
-
if(index_ < 0 || index_ >= self_.array.length) {
|
|
89
|
-
ff_core_Try.internalThrowGrabException_()
|
|
90
|
-
}
|
|
91
|
-
self_.array[index_] = body_(self_.array[index_])
|
|
92
|
-
"""
|
|
93
|
-
target js async """
|
|
94
|
-
if(index_ < 0 || index_ >= self_.array.length) {
|
|
95
|
-
ff_core_Try.internalThrowGrabException_()
|
|
96
|
-
}
|
|
97
|
-
self_.array[index_] = await body_(self_.array[index_], $task)
|
|
98
|
-
"""
|
|
99
|
-
|
|
100
|
-
fill(value: T, start: Int = 0, end: Int = 9007199254740991): Unit
|
|
101
|
-
target js sync """
|
|
102
|
-
self_.array.fill(value_, start_, end_);
|
|
103
|
-
"""
|
|
104
|
-
|
|
105
|
-
copy(target: Int, start: Int, end: Int): Unit
|
|
106
|
-
target js sync """
|
|
107
|
-
self_.array.copyWithin(target_, start_, end_);
|
|
108
|
-
"""
|
|
109
|
-
|
|
110
|
-
delete(start: Int, deleteCount: Int): Unit
|
|
111
|
-
target js sync """
|
|
112
|
-
self_.array.splice(start_, deleteCount_);
|
|
113
|
-
"""
|
|
114
|
-
|
|
115
|
-
insert(start: Int, value: T, deleteCount: Int = 0): Unit
|
|
116
|
-
target js sync """
|
|
117
|
-
self_.array.splice(start_, deleteCount_, value_);
|
|
118
|
-
"""
|
|
119
|
-
|
|
120
|
-
insertArray(start: Int, value: Array[T], deleteCount: Int = 0): Unit
|
|
121
|
-
target js sync """
|
|
122
|
-
self_.array.splice(start_, deleteCount_, ...value_.array);
|
|
123
|
-
"""
|
|
124
|
-
|
|
125
|
-
insertList(start: Int, value: List[T], deleteCount: Int = 0): Unit
|
|
126
|
-
target js sync """
|
|
127
|
-
self_.array.splice(start_, deleteCount_, ...value_);
|
|
128
|
-
"""
|
|
129
|
-
|
|
130
|
-
each(body: T => Unit): Unit
|
|
131
|
-
target js sync """
|
|
132
|
-
return self_.array.forEach(body_);
|
|
133
|
-
"""
|
|
134
|
-
target js async """
|
|
135
|
-
for(let i = 0; i < self_.array.length; i++) {
|
|
136
|
-
await body_(self_.array[i], $task)
|
|
137
|
-
}
|
|
138
|
-
"""
|
|
139
|
-
|
|
140
|
-
eachWhile(body: T => Bool): Unit
|
|
141
|
-
target js sync "for(const value of self_.array) if(!body_(value)) break"
|
|
142
|
-
target js async "for(const value of self_.array) if(!await body_(value, $task)) break"
|
|
143
|
-
|
|
144
|
-
all(body: T => Bool): Bool {
|
|
145
|
-
mutable result = True
|
|
146
|
-
self.eachWhile {x =>
|
|
147
|
-
result = body(x)
|
|
148
|
-
result
|
|
149
|
-
}
|
|
150
|
-
result
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
any(body: T => Bool): Bool {
|
|
154
|
-
mutable result = False
|
|
155
|
-
self.eachWhile {x =>
|
|
156
|
-
result = body(x)
|
|
157
|
-
(!result)
|
|
158
|
-
}
|
|
159
|
-
result
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
indexWhere(body: T => Bool): Option[Int] {
|
|
163
|
-
mutable i = -1
|
|
164
|
-
mutable result = False
|
|
165
|
-
self.eachWhile {x =>
|
|
166
|
-
i += 1
|
|
167
|
-
result = body(x)
|
|
168
|
-
(!result)
|
|
169
|
-
}
|
|
170
|
-
if(result) {i}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
drain(): List[T]
|
|
174
|
-
target js sync "const result = self_.array; self_.array = []; return result"
|
|
175
|
-
|
|
176
|
-
toList(start: Int = 0, end: Int = 9007199254740991): List[T]
|
|
177
|
-
target js sync """return self_.array.slice(start_, end_)"""
|
|
178
|
-
|
|
179
|
-
toStream(start: Int = 0, end: Int = 9007199254740991): Stream[T] {
|
|
180
|
-
self.toList(start, end).toStream()
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
reverse(): Unit
|
|
184
|
-
target js sync "self_.array.reverse()"
|
|
185
|
-
|
|
186
|
-
sortBy[S: Order](body: T => S): Unit {
|
|
187
|
-
self.sortWith {Ordering.compare(body(_), body(_))}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
sortWith(ordering: (T, T) => Ordering): Unit {
|
|
191
|
-
sortRange(self, ordering, 0, self.size())
|
|
192
|
-
}
|
|
193
|
-
target js sync "self_.array.sort((x, y) => ff_core_Ordering.Ordering_toInt(ordering_(x, y)))"
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
extend self[T: Order]: Array[T] {
|
|
198
|
-
|
|
199
|
-
sort(): Unit {
|
|
200
|
-
self.sortWith(Ordering.compare)
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
extend self: Array[String] {
|
|
206
|
-
|
|
207
|
-
join(separator: String = ""): String
|
|
208
|
-
target js sync "return self_.array.join(separator_)"
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
instance Array[T: Show]: Show {
|
|
213
|
-
show(value: Array[T]): String {
|
|
214
|
-
let array = Array.make()
|
|
215
|
-
array.push("[")
|
|
216
|
-
value.each {x =>
|
|
217
|
-
if(array.size() > 1) {array.push(", ")}
|
|
218
|
-
array.push(Show.show(x))
|
|
219
|
-
}
|
|
220
|
-
array.push("].toArray()")
|
|
221
|
-
array.join()
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
sortRange[T](array: Array[T], compare: (T, T) => Ordering, start: Int, end: Int): Unit {
|
|
226
|
-
if(end - start < 2) {} else:
|
|
227
|
-
|
|
228
|
-
mutable middle = start + ((end - start) / 2)
|
|
229
|
-
sortRange(array, compare, start, middle)
|
|
230
|
-
sortRange(array, compare, middle, end)
|
|
231
|
-
|
|
232
|
-
mutable i = start
|
|
233
|
-
mutable j = middle
|
|
234
|
-
while {i < middle && j < end} {
|
|
235
|
-
if(compare(array.grab(i), array.grab(j)) != OrderingAfter) {
|
|
236
|
-
i += 1
|
|
237
|
-
} else {
|
|
238
|
-
let value = array.grab(j)
|
|
239
|
-
mutable k = j
|
|
240
|
-
while {k > i} {
|
|
241
|
-
array.set(k, array.grab(k - 1))
|
|
242
|
-
k -= 1
|
|
243
|
-
}
|
|
244
|
-
array.set(i, value)
|
|
245
|
-
i += 1
|
|
246
|
-
middle += 1
|
|
247
|
-
j += 1
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|