From 2ba1abe6267b2d027828f02f2b07b4c5ac17a97c Mon Sep 17 00:00:00 2001 From: "Evan W. Patton" Date: Wed, 22 Jan 2025 12:36:27 -0500 Subject: [PATCH] Fix alist to dict handling in iOS 2.73 Change-Id: Ibc83e0aae5d5fb58c89591079cb8117a08c105b9 --- appinventor/schemekit/src/yail.m | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/appinventor/schemekit/src/yail.m b/appinventor/schemekit/src/yail.m index 60f28c8ac4..3c5e151fe4 100644 --- a/appinventor/schemekit/src/yail.m +++ b/appinventor/schemekit/src/yail.m @@ -1430,12 +1430,25 @@ pic_value yail_get_simple_name(pic_state *pic) { pic_get_args(pic, "o", &entries); - if (!yail_list_p(pic, entries)) { + YailDictionary *dict = nil; + if (yail_list_p(pic, entries)) { + YailList *listOfEntries = yail_list_objc(pic, entries); + dict = [YailDictionary dictionaryFromPairs:pic_cdr(pic, listOfEntries.value)]; + } else if (pic_pair_p(pic, entries)) { + pic_value car = pic_car(pic, entries); + if (pic_eq_p(pic, pic_intern(pic, pic_str_value(pic, "*list*", 6)), car)) { + dict = [YailDictionary dictionaryFromPairs:pic_cdr(pic, entries)]; + } else { + pic_error(pic, "YailDictionary:alistToDict: Received malformed list", 1, entries); + } + } else { pic_error(pic, "YailDictionary:alistToDict: YailList required", 1, entries); } - YailList *listOfEntries = yail_list_objc(pic, entries); - YailDictionary *dict = [YailDictionary dictionaryFromPairs:pic_cdr(pic, listOfEntries.value)]; - return yail_make_native_yaildictionary(pic, dict); + if (dict != nil) { + return yail_make_native_yaildictionary(pic, dict); + } else { + return pic_nil_value(pic); + } } static pic_value