fez-lisp 1.5.105 → 1.5.106

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.105",
5
+ "version": "1.5.106",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/check.js CHANGED
@@ -34,7 +34,8 @@ import {
34
34
  ANY,
35
35
  formatType,
36
36
  ANONYMOUS_FUNCTION_TYPE_PREFIX,
37
- validateLambda
37
+ validateLambda,
38
+ NIL
38
39
  } from './types.js'
39
40
  import {
40
41
  Brr,
@@ -345,7 +346,7 @@ const ifExpression = ({ re, env, ref, prop }) => {
345
346
  // TODO make this more simple - it's so many different things just because types are functions or not
346
347
  // WHY not consiter making return types for everything
347
348
  if (concequent)
348
- if (conc[TYPE] === WORD) {
349
+ if (conc[TYPE] === WORD && conc[VALUE] !== NIL) {
349
350
  return setPropToTypeRef(ref[STATS], prop, concequent[STATS])
350
351
  } else if (
351
352
  conc[TYPE] === APPLY &&
@@ -363,7 +364,7 @@ const ifExpression = ({ re, env, ref, prop }) => {
363
364
  })
364
365
  }
365
366
  if (alternative) {
366
- if (alt[TYPE] === WORD) {
367
+ if (alt[TYPE] === WORD && alt[VALUE] !== NIL) {
367
368
  return setPropToTypeRef(ref[STATS], prop, alternative[STATS])
368
369
  } else if (
369
370
  alt[TYPE] === APPLY &&
package/src/macros.js CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  WORD
17
17
  } from './keywords.js'
18
18
  import { hasBlock, stringifyArgs } from './utils.js'
19
+ import { NIL } from './types.js'
19
20
  export const SUGGAR = {
20
21
  // Syntactic suggars
21
22
  PIPE: '|>',
@@ -357,7 +358,7 @@ export const deSuggarAst = (ast, scope) => {
357
358
  )
358
359
  exp[0][VALUE] = KEYWORDS.IF
359
360
  const temp = exp[2]
360
- exp[2] = exp[3] ?? [ATOM, FALSE]
361
+ exp[2] = exp[3] ?? [WORD, NIL]
361
362
  exp[3] = temp
362
363
  }
363
364
  deSuggarAst(exp, scope)
@@ -372,7 +373,7 @@ export const deSuggarAst = (ast, scope) => {
372
373
  KEYWORDS.IF
373
374
  } ${stringifyArgs(rest)})`
374
375
  )
375
- if (rest.length === 2) exp.push([ATOM, FALSE])
376
+ if (rest.length === 2) exp.push([WORD, NIL])
376
377
  }
377
378
  deSuggarAst(exp[1], scope)
378
379
  break
package/src/types.js CHANGED
@@ -24,6 +24,7 @@ export const ANY = 5
24
24
  export const ANONYMOUS_FUNCTION_TYPE_PREFIX = 'lambda::annonymous::'
25
25
  export const MAX_ARGUMENT_RETRY = 1
26
26
  export const MAX_RETRY_DEFINITION = 100
27
+ export const NIL = 'nil'
27
28
  export const toTypeNames = (type) => {
28
29
  switch (type) {
29
30
  case APPLY: