fez-lisp 1.5.137 → 1.5.138

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/check.js +9 -7
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "fez-lisp",
3
3
  "description": "Lisp interpreted & compiled to JavaScript",
4
4
  "author": "AT290690",
5
- "version": "1.5.137",
5
+ "version": "1.5.138",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/check.js CHANGED
@@ -224,10 +224,13 @@ export const setReturnToTypeRef = (stats, value) => {
224
224
  }
225
225
  export const setStatsRef = (a, b) => (a[STATS] = b[STATS])
226
226
  export const setTypeToReturnRef = (stats, value) => {
227
- return (
228
- (isUnknownType(stats) || isAnyType(stats)) &&
229
- (stats[TYPE_PROP] = value[RETURNS])
230
- )
227
+ // To prevent getters overwritting the array subtype
228
+ // Change main type if uknown
229
+ if (isUnknownType(stats) || isAnyType(stats))
230
+ stats[TYPE_PROP][0] = value[RETURNS][0]
231
+ // cange sub type if it doesn't have
232
+ if (!hasSubType(stats) || getSubType(stats).has(UNKNOWN))
233
+ stats[TYPE_PROP][1] = value[RETURNS][1]
231
234
  }
232
235
  export const setPropRef = (stats, prop, value) => {
233
236
  return (
@@ -424,16 +427,15 @@ const withScope = (name, scope) => {
424
427
  const chain = getScopeNames(scope)
425
428
  return `${chain.length === 1 ? '; ' : ''}${chain.join(' ')} ${name}`
426
429
  }
427
- const retry = (stats, ctx, stack, cb) => {
430
+ const retry = (stats, ctx, stack, cb, method = 'prepend') => {
428
431
  if (
429
432
  (isUnknownNotAnyType(stats) || isUnknownNotAnyReturn(stats)) &&
430
433
  stats.retried < MAX_RETRY_DEFINITION
431
434
  ) {
432
435
  stats.retried += 1
433
- stagger(stack, 'prepend', ctx, cb)
436
+ stagger(stack, method, ctx, cb)
434
437
  }
435
438
  }
436
-
437
439
  const retryArgs = (stats, ctx, stack, cb) => {
438
440
  if (stats.counter < MAX_ARGUMENT_RETRY) {
439
441
  stats.counter++