fez-lisp 1.3.5 → 1.3.6
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 +1 -1
- package/src/interpreter.js +12 -6
package/package.json
CHANGED
package/src/interpreter.js
CHANGED
@@ -147,20 +147,26 @@ export const keywords = {
|
|
147
147
|
return a % b
|
148
148
|
},
|
149
149
|
[KEYWORDS.BITWISE_AND]: (args, env) => {
|
150
|
-
if (args.length
|
150
|
+
if (args.length !== 2)
|
151
151
|
throw new RangeError(
|
152
152
|
`Invalid number of arguments to (${
|
153
153
|
KEYWORDS.BITWISE_AND
|
154
154
|
}) (= 2 required). (${KEYWORDS.BITWISE_AND} ${stringifyArgs(args)})`
|
155
155
|
)
|
156
|
-
|
157
|
-
|
156
|
+
if (typeof a !== 'number')
|
157
|
+
throw new TypeError(
|
158
|
+
`First arguments of (${KEYWORDS.BITWISE_AND}) is not a (${
|
159
|
+
RUNTIME_TYPES.NUMBER
|
160
|
+
}) (${KEYWORDS.BITWISE_AND} ${stringifyArgs(args)})`
|
161
|
+
)
|
162
|
+
const b = evaluate(args[1], env)
|
163
|
+
if (typeof b !== 'number')
|
158
164
|
throw new TypeError(
|
159
|
-
`
|
165
|
+
`Second arguments of (${KEYWORDS.BITWISE_AND}) is not a (${
|
160
166
|
RUNTIME_TYPES.NUMBER
|
161
|
-
} (${KEYWORDS.BITWISE_AND} ${stringifyArgs(args)})`
|
167
|
+
}) (${KEYWORDS.BITWISE_AND} ${stringifyArgs(args)})`
|
162
168
|
)
|
163
|
-
return
|
169
|
+
return a & b
|
164
170
|
},
|
165
171
|
[KEYWORDS.BITWISE_NOT]: (args, env) => {
|
166
172
|
if (args.length !== 1)
|