fun argCompiler() { true }
fun lookupFun(a, b) { true }
public fun compileSM0 (stmt, env) {
case stmt of
Call(fname, args) ->
-- TODO is order of args ok? (maybe reverse)
local argsCode = foldl(argCompiler, [{}, env], args);
case lookupFun(env, fname) of Fun(fLabel, nargs) ->
if nargs != size(args) then failure("expected %d arguments for function %s, found: %s", nargs, fname, size(args)) fi
[argsCode +++ singleton(CALL (fname, size(args)))]
esac
esac
}
`
Problem: code below failed during compile.
Message: Fatal error: exception File "X86.ml", line 677, characters 17-22: Pattern matching failed
Code:
` import Ref; import Array; import List; import Fun; import Collection; import Buffer;
fun argCompiler() { true } fun lookupFun(a, b) { true }
public fun compileSM0 (stmt, env) { case stmt of Call(fname, args) -> -- TODO is order of args ok? (maybe reverse) local argsCode = foldl(argCompiler, [{}, env], args); case lookupFun(env, fname) of Fun(fLabel, nargs) -> if nargs != size(args) then failure("expected %d arguments for function %s, found: %s", nargs, fname, size(args)) fi [argsCode +++ singleton(CALL (fname, size(args)))] esac esac } `
Version: commit 1849c7029b1d6cf0468e5587c1b2715e00a3b47e