fez-lisp 1.5.79 → 1.5.81
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/lib/baked/std.js +1 -1
- package/package.json +1 -1
- package/src/check.js +19 -11
- package/src/types.js +1 -1
package/package.json
CHANGED
package/src/check.js
CHANGED
@@ -83,25 +83,30 @@ const fillUknownArgs = (n) =>
|
|
83
83
|
}))
|
84
84
|
export const formatType = (name, env) => {
|
85
85
|
const stats = env[name][STATS]
|
86
|
+
const isAnonymous = typeof name === 'number'
|
86
87
|
return stats
|
87
88
|
? stats[TYPE_PROP][0] === APPLY
|
88
|
-
? `${name} (${
|
89
|
+
? `${isAnonymous ? '' : `(let ${name} `}(lambda ${
|
89
90
|
stats[ARG_COUNT] === VARIADIC
|
90
91
|
? '... ' + STATIC_TYPES.UNKNOWN
|
91
92
|
: (stats[ARGUMENTS] ?? [])
|
92
93
|
.map(
|
93
|
-
(x) =>
|
94
|
-
`${
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
94
|
+
(x, i) =>
|
95
|
+
`${
|
96
|
+
x[STATS][TYPE_PROP][0] === APPLY
|
97
|
+
? `${formatType(i, stats[ARGUMENTS])}`
|
98
|
+
: `${toTypeNames(
|
99
|
+
x[STATS][TYPE_PROP][1] ?? x[STATS][TYPE_PROP][0]
|
100
|
+
)}`
|
100
101
|
}`
|
101
102
|
)
|
102
103
|
.join(' ')
|
103
|
-
}
|
104
|
-
|
104
|
+
} (${KEYWORDS.BLOCK} ${toTypeNames(
|
105
|
+
stats[RETURNS][1] ?? stats[RETURNS][0]
|
106
|
+
)})${isAnonymous ? '' : ')'})`
|
107
|
+
: `(let ${name} ${toTypeNames(
|
108
|
+
stats[TYPE_PROP][1] ?? stats[TYPE_PROP][0]
|
109
|
+
)})`
|
105
110
|
: name
|
106
111
|
}
|
107
112
|
const formatTypes = (env) => {
|
@@ -124,7 +129,7 @@ const getScopeNames = (scope) => {
|
|
124
129
|
}
|
125
130
|
const withScope = (name, scope) => {
|
126
131
|
const chain = getScopeNames(scope)
|
127
|
-
return `${chain.length === 1 ? '
|
132
|
+
return `${chain.length === 1 ? '; ' : ''}${chain
|
128
133
|
.map((x) => (Number.isInteger(+x) ? '::' : x))
|
129
134
|
.join(' ')} ${name}`
|
130
135
|
}
|
@@ -407,6 +412,7 @@ export const typeCheck = (ast) => {
|
|
407
412
|
env[name] = {
|
408
413
|
[STATS]: {
|
409
414
|
[TYPE_PROP]: [APPLY],
|
415
|
+
[SIGNATURE]: name,
|
410
416
|
retried: 0,
|
411
417
|
counter: 0,
|
412
418
|
[VARIABLE_ORDER_INDEX]: env[ORDER],
|
@@ -471,6 +477,7 @@ export const typeCheck = (ast) => {
|
|
471
477
|
// DECLARATION of ATOM
|
472
478
|
env[name] = {
|
473
479
|
[STATS]: {
|
480
|
+
[SIGNATURE]: name,
|
474
481
|
retried: 0,
|
475
482
|
counter: 0,
|
476
483
|
[VARIABLE_ORDER_INDEX]: env[ORDER],
|
@@ -508,6 +515,7 @@ export const typeCheck = (ast) => {
|
|
508
515
|
[STATS]: {
|
509
516
|
retried: 0,
|
510
517
|
counter: 0,
|
518
|
+
[SIGNATURE]: name,
|
511
519
|
[VARIABLE_ORDER_INDEX]: env[ORDER],
|
512
520
|
[TYPE_PROP]: [
|
513
521
|
isL
|