substituteFuncs method

AST substituteFuncs(
  1. AST ast,
  2. List<FuncDecl> from,
  3. List<AST> to
)

Implementation

AST substituteFuncs(AST ast, List<FuncDecl> from, List<AST> to) {
  assert(from.length == to.length);
  final fromPtr = calloc<Z3_func_decl>(from.length);
  final toPtr = calloc<Z3_ast>(to.length);
  try {
    for (var i = 0; i < from.length; i++) {
      fromPtr[i] = _createFuncDecl(from[i]);
      toPtr[i] = _createAST(to[i]);
    }
    final result = _z3.substitute_funs(
      _createAST(ast),
      from.length,
      fromPtr,
      toPtr,
    );
    return _getAST(result);
  } finally {
    malloc.free(fromPtr);
    malloc.free(toPtr);
  }
}