fez-lisp 1.6.1 → 1.6.3

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.6.1",
5
+ "version": "1.6.3",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/check.js CHANGED
@@ -521,8 +521,9 @@ const IfApplyBranch = ({
521
521
  break
522
522
  case KEYWORDS.CALL_FUNCTION:
523
523
  if (re.at(-1)[TYPE] === WORD) {
524
- if (env[re.at(-1)[VALUE]] && re.at(-1)[VALUE] !== ref[STATS][SIGNATURE])
525
- setPropToReturnRef(ref[STATS], prop, env[re.at(-1)[VALUE]][STATS])
524
+ const name = re.at(-1)[VALUE]
525
+ if (env[name] && re.at(-1)[VALUE] !== ref[STATS][SIGNATURE])
526
+ setPropToReturnRef(ref[STATS], prop, env[name][STATS])
526
527
  } else {
527
528
  const returns = returnType(re.at(-1))
528
529
  if (env[returns[VALUE]] && returns[VALUE] !== ref[STATS][SIGNATURE])
@@ -1203,38 +1204,8 @@ export const typeCheck = (ast, ctx = SPECIAL_FORM_TYPES) => {
1203
1204
  )})`
1204
1205
  )
1205
1206
  if (name in env) {
1206
- // const [head, ...tail] = isLeaf(rest.at(-1))
1207
- // ? [rest.at(-1)]
1208
- // : rest.at(-1)
1209
- // const ref = env[name]
1210
- // if (ref) {
1211
- // if (getType(ref[STATS]) === APPLY && head[TYPE] !== APPLY)
1212
- // throw new TypeError(
1213
- // `Miss-matching type for (${name}) predifined expected type is (${toTypeNames(
1214
- // APPLY
1215
- // )}) but got (${stringifyArgs(exp)})`
1216
- // )
1217
- // const returns = deepLambdaReturn(
1218
- // hasBlock(tail) ? tail.at(-1) : tail,
1219
- // (result) => result[VALUE] !== KEYWORDS.IF
1220
- // )
1221
- // const [rhead] = isLeaf(returns) ? [returns] : returns
1222
- // const rightRef = env[rhead[VALUE]]
1223
- // if (rightRef)
1224
- // if (
1225
- // !equalReturns(ref[STATS], rightRef[STATS]) ||
1226
- // !equalSubReturns(ref[STATS], rightRef[STATS])
1227
- // )
1228
- // throw new TypeError(
1229
- // `Miss-matching return type for (${name}) predifined expected return is (${formatSubType(
1230
- // getReturns(ref[STATS])
1231
- // )}) but got (${formatSubType(
1232
- // getReturns(rightRef[STATS])
1233
- // )}) (${stringifyArgs(exp)})`
1234
- // )
1235
- // }
1236
1207
  Types.set(withScope(name, env), () => formatType(name, env))
1237
- break
1208
+ if (!env[env[SCOPE_NAME]]) break
1238
1209
  }
1239
1210
  // Predicate name consistency
1240
1211
  const rightHand = rest.at(-1)
@@ -1816,8 +1787,9 @@ export const typeCheck = (ast, ctx = SPECIAL_FORM_TYPES) => {
1816
1787
  stagger(stack, 'prepend', [first, env], judge)
1817
1788
  for (let i = 0; i < rest.length; ++i) {
1818
1789
  const r = rest[i]
1819
- if (isLeaf(r) && r[TYPE] !== ATOM)
1820
- if (env[r[VALUE]] == undefined)
1790
+ if (isLeaf(r) && r[TYPE] !== ATOM) {
1791
+ const name = r[VALUE]
1792
+ if (env[name] == undefined)
1821
1793
  throw new TypeError(
1822
1794
  `(${
1823
1795
  first[VALUE]
@@ -1825,6 +1797,7 @@ export const typeCheck = (ast, ctx = SPECIAL_FORM_TYPES) => {
1825
1797
  r[VALUE]
1826
1798
  }) at argument (${i}) (${stringifyArgs(exp)}) (check #20)`
1827
1799
  )
1800
+ }
1828
1801
  check(r, env, scope)
1829
1802
  }
1830
1803
  break