remove raise
This commit is contained in:
parent
1c98aaa3e2
commit
5d17301016
|
@ -14,8 +14,6 @@ module T = Reducer_Expression_T
|
||||||
type errorValue = Reducer_ErrorValue.errorValue
|
type errorValue = Reducer_ErrorValue.errorValue
|
||||||
type t = T.t
|
type t = T.t
|
||||||
|
|
||||||
exception ErrorException = Reducer_ErrorValue.ErrorException
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Recursively evaluate/reduce the expression (Lisp AST/Lambda calculus)
|
Recursively evaluate/reduce the expression (Lisp AST/Lambda calculus)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,7 +23,7 @@ let checkArity = (
|
||||||
let argsLength = Belt.List.length(args)
|
let argsLength = Belt.List.length(args)
|
||||||
let parametersLength = Js.Array2.length(lambdaValue.parameters)
|
let parametersLength = Js.Array2.length(lambdaValue.parameters)
|
||||||
if argsLength !== parametersLength {
|
if argsLength !== parametersLength {
|
||||||
raise(ErrorValue.ErrorException(ErrorValue.REArityError(None, parametersLength, argsLength)))
|
ErrorValue.REArityError(None, parametersLength, argsLength)->ErrorValue.toException
|
||||||
} else {
|
} else {
|
||||||
args
|
args
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ let checkArity = (
|
||||||
let checkIfReduced = (args: list<internalExpressionValue>) =>
|
let checkIfReduced = (args: list<internalExpressionValue>) =>
|
||||||
args->Belt.List.reduceReverse(list{}, (acc, arg) =>
|
args->Belt.List.reduceReverse(list{}, (acc, arg) =>
|
||||||
switch arg {
|
switch arg {
|
||||||
| IEvSymbol(symbol) => raise(ErrorValue.ErrorException(ErrorValue.RESymbolNotFound(symbol)))
|
| IEvSymbol(symbol) => ErrorValue.RESymbolNotFound(symbol)->ErrorValue.toException
|
||||||
| _ => list{arg, ...acc}
|
| _ => list{arg, ...acc}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -63,7 +63,7 @@ let caseNotFFI = (
|
||||||
let caseFFI = (ffiFn: ExpressionT.ffiFn, args, accessors: ProjectAccessorsT.t) => {
|
let caseFFI = (ffiFn: ExpressionT.ffiFn, args, accessors: ProjectAccessorsT.t) => {
|
||||||
switch ffiFn(args->Belt.List.toArray, accessors.environment) {
|
switch ffiFn(args->Belt.List.toArray, accessors.environment) {
|
||||||
| Ok(value) => value
|
| Ok(value) => value
|
||||||
| Error(value) => raise(ErrorValue.ErrorException(value))
|
| Error(value) => value->ErrorValue.toException
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user