fez-lisp 1.5.71 → 1.5.72

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/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.71",
5
+ "version": "1.5.72",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/check.js CHANGED
@@ -87,7 +87,7 @@ export const formatType = (name, env) => {
87
87
  )
88
88
  .join(' ')
89
89
  }) -> ${toTypeNames(stats[RETURNS][1] ?? stats[RETURNS][0])}`
90
- : `${name} ${stats[TYPE_PROP].map(toTypeNames).join(' ')}`
90
+ : `${name} ${stats[TYPE_PROP].map(toTypeNames).join(' ')}`.trim()
91
91
  : name
92
92
  }
93
93
  const formatTypes = (env) => {
@@ -111,7 +111,7 @@ const getScopeNames = (scope) => {
111
111
  const withScope = (name, scope) => {
112
112
  const chain = getScopeNames(scope)
113
113
  return `${chain.length === 1 ? '· ' : ''}${chain
114
- .map((x) => (Number.isInteger(+x) ? '~' : x))
114
+ .map((x) => (Number.isInteger(+x) ? '::' : x))
115
115
  .join(' ')} ${name}`
116
116
  }
117
117
  export const typeCheck = (ast) => {
@@ -312,6 +312,16 @@ export const typeCheck = (ast) => {
312
312
  )
313
313
  }
314
314
  }
315
+ // ALWAYS APPLY
316
+ // rest.at(-1)[0][TYPE] === APPLY
317
+ // Here is upon application to store the result in the variable
318
+ if (env[name][STATS][TYPE_PROP][0] === UNKNOWN)
319
+ stack.unshift(() => {
320
+ env[name][STATS][TYPE_PROP][0] =
321
+ env[returns[VALUE]][STATS][RETURNS][0]
322
+ env[name][STATS][TYPE_PROP][1] =
323
+ env[returns[VALUE]][STATS][RETURNS][1]
324
+ })
315
325
  env[name][STATS][RETURNS] =
316
326
  env[returns[VALUE]][STATS][RETURNS]
317
327
  } else {
@@ -603,7 +613,6 @@ export const typeCheck = (ast) => {
603
613
  )
604
614
  if (isLeaf(returns)) {
605
615
  // TODO figure out what we do here
606
- // console.log({ returns }, ref, copy[param[VALUE]][STATS])
607
616
  } else {
608
617
  const ret = returns[0]
609
618
  switch (ret[VALUE]) {
@@ -647,7 +656,12 @@ export const typeCheck = (ast) => {
647
656
  if (copy[ret[VALUE]])
648
657
  ref[STATS][RETURNS] =
649
658
  copy[ret[VALUE]][STATS][RETURNS]
650
- // function is anonymous
659
+ else
660
+ stack.push(() => {
661
+ if (copy[ret[VALUE]])
662
+ ref[STATS][RETURNS] =
663
+ copy[ret[VALUE]][STATS][RETURNS]
664
+ })
651
665
  break
652
666
  }
653
667
  }
package/src/keywords.js CHANGED
@@ -68,10 +68,10 @@ export const DEBUG = {
68
68
  STRING: 'string',
69
69
  LOG: 'log',
70
70
  ASSERT: 'assert',
71
- SIGNATURE: '?',
71
+ SIGNATURE: 'Info',
72
72
  LIST_THEMES: 'theme?',
73
73
  SET_THEME: 'theme!',
74
- TYPE_SIGNATURE: 't?'
74
+ TYPE_SIGNATURE: 'T'
75
75
  }
76
76
 
77
77
  export const SPECIAL_FORMS_SET = new Set(