diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 699580f..0fd8f6b 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -9,7 +9,7 @@ on: jobs: macosbuild: - runs-on: macos-11 + runs-on: macos-12 steps: # Force xmake to a specific folder (for cache) - name: Set xmake global dir diff --git a/moebius/drd/drd_info.cpp b/moebius/drd/drd_info.cpp index 7e7bb4b..c486c48 100644 --- a/moebius/drd/drd_info.cpp +++ b/moebius/drd/drd_info.cpp @@ -762,7 +762,7 @@ drd_info_rep::get_env_child (tree t, int i, tree env) { tag_info ti = info[L (t)]; int index= ti->get_index (i, N (t)); - if ((index < 0) || (index >= N (ti->ci))) return ""; + if ((index < 0) || (index >= N (ti->ci))) return tree (ATTR); tree cenv= drd_decode (ti->ci[index].env); for (int i= 1; i < N (cenv); i+= 2) if (is_func (cenv[i], ARG, 1) && is_int (cenv[i][0])) { @@ -787,7 +787,7 @@ drd_info_rep::get_env_descendant (tree t, path p, tree env) { path q= p->next; if (is_compound (t) && i >= 0 && i < N (t)) return get_env_descendant (t[i], q, get_env_child (t, i, env)); - return ""; + return tree (ATTR); } tree @@ -813,7 +813,7 @@ tree drd_info_rep::arg_access (tree t, tree arg, tree env, int& type, bool& found) { // returns "" if unaccessible and the env if accessible // cout << " arg_access " << t << ", " << arg << ", " << env << "\n"; - if (is_atomic (t)) return ""; + if (is_atomic (t)) return tree (ATTR); else if (t == arg) { found= true; return env; @@ -822,9 +822,9 @@ drd_info_rep::arg_access (tree t, tree arg, tree env, int& type, bool& found) { return env; else if (is_func (t, MAP_ARGS) && (t[2] == arg[0])) { if ((N (t) >= 4) && (N (arg) >= 2) && (as_int (t[3]) > as_int (arg[1]))) - return ""; + return tree (ATTR); if ((N (t) == 5) && (N (arg) >= 2) && (as_int (t[3]) <= as_int (arg[1]))) - return ""; + return tree (ATTR); tree_label inner= make_tree_label (as_string (t[0])); tree_label outer= make_tree_label (as_string (t[1])); if (get_nr_indices (inner) > 0) type= get_type_child (tree (inner, arg), 0); @@ -832,9 +832,9 @@ drd_info_rep::arg_access (tree t, tree arg, tree env, int& type, bool& found) { (get_accessible (inner, 0) == ACCESSIBLE_ALWAYS) && all_accessible (outer)) return env; - return ""; + return tree (ATTR); } - else if (is_func (t, MACRO)) return ""; + else if (is_func (t, MACRO)) return tree (ATTR); else if (is_func (t, WITH)) { int n= N (t) - 1; // cout << "env= " << drd_env_merge (env, t (0, n)) << "\n"; @@ -876,7 +876,7 @@ drd_info_rep::arg_access (tree t, tree arg, tree env, int& type, bool& found) { // cout << " found type " << t << ", " << arg << ", " << type << "\n"; } } - return ""; + return tree (ATTR); } } diff --git a/tests/moebius/drd/drd_info_test.cpp b/tests/moebius/drd/drd_info_test.cpp new file mode 100644 index 0000000..6bd4869 --- /dev/null +++ b/tests/moebius/drd/drd_info_test.cpp @@ -0,0 +1,27 @@ +/** \file drd_info_test.cpp + * \copyright GPLv3 + * \details Unitests for drd data structure + * \author jingkaimori + * \date 2024 + */ + +#include "moe_doctests.hpp" +#include "moebius/drd/drd_info.hpp" +#include "tree_helper.hpp" + +using namespace moebius; + +using moebius::drd::drd_info; + +TEST_CASE ("drd initialize macro") { + drd_info test_drd ("test"); + test_drd->heuristic_init_macro ( + "test-macro", + tree (MACRO, "arg1", "arg2", + tree (CONCAT, tree (ARG, "arg1"), " text ", tree (ARG, "arg2")))); + tree_label test_macro_label= make_tree_label ("test-macro"); + CHECK_EQ (test_drd->get_arity_base (test_macro_label), 2); + CHECK_EQ (test_drd->get_arity_extra (test_macro_label), 0); + CHECK_EQ (test_drd->get_arity_mode (test_macro_label), ARITY_NORMAL); + CHECK_EQ (test_drd->get_nr_indices (test_macro_label), 2); +} \ No newline at end of file diff --git a/xmake/packages/l/lolly/xmake.lua b/xmake/packages/l/lolly/xmake.lua index 9722848..bbb6ad2 100644 --- a/xmake/packages/l/lolly/xmake.lua +++ b/xmake/packages/l/lolly/xmake.lua @@ -24,7 +24,7 @@ package("lolly") add_urls("https://github.com/XmacsLabs/lolly.git") add_urls("https://gitee.com/XmacsLabs/lolly.git") - add_versions("1.4.26", "v1.4.26") + add_versions("1.4.25", "v1.4.25") add_deps("tbox") if not is_plat("wasm") then