Remove setOf, listOf, dictOf builtins (all unused)

This commit is contained in:
K. Lange 2022-07-05 11:42:04 +09:00
parent 87f6c316bd
commit 31509bcc3c
4 changed files with 3 additions and 20 deletions

View File

@ -555,32 +555,24 @@ extern int krk_callValue(KrkValue callee, int argCount, int callableOnStack);
/**
* @brief Create a list object.
* @memberof KrkList
*
* This is the native function bound to @c listOf
*/
extern KrkValue krk_list_of(int argc, const KrkValue argv[], int hasKw);
/**
* @brief Create a dict object.
* @memberof KrkDict
*
* This is the native function bound to @c dictOf
*/
extern KrkValue krk_dict_of(int argc, const KrkValue argv[], int hasKw);
/**
* @brief Create a tuple object.
* @memberof KrkTuple
*
* This is the native function bound to @c tupleOf
*/
extern KrkValue krk_tuple_of(int argc, const KrkValue argv[], int hasKw);
/**
* @brief Create a set object.
* @memberof Set
*
* This is the native function bound to @c setOf
*/
extern KrkValue krk_set_of(int argc, const KrkValue argv[], int hasKw);

View File

@ -13,10 +13,10 @@
/**
* Exposed method called to produce dictionaries from `{expr: expr, ...}` sequences in managed code.
* Presented in the global namespace as `dictOf(...)`. Expects arguments as `key,value,key,value`...
* Expects arguments as `key,value,key,value`...
*/
KrkValue krk_dict_of(int argc, const KrkValue argv[], int hasKw) {
if (argc % 2 != 0) return krk_runtimeError(vm.exceptions->argumentError, "Expected even number of arguments to dictOf");
if (argc % 2 != 0) return krk_runtimeError(vm.exceptions->argumentError, "Expected even number of arguments to krk_dict_of");
KrkInstance * outDict = krk_newInstance(vm.baseClasses->dictClass);
krk_push(OBJECT_VAL(outDict));
krk_initTable(&((KrkDict*)outDict)->entries);
@ -523,8 +523,6 @@ void _createAndBind_dictClass(void) {
krk_finalizeClass(dict);
KRK_DOC(dict, "Mapping of arbitrary keys to values.");
BUILTIN_FUNCTION("dictOf", krk_dict_of, "Convert argument sequence to dict object.");
KrkClass * dictitems = ADD_BASE_CLASS(vm.baseClasses->dictitemsClass, "dictitems", vm.baseClasses->objectClass);
dictitems->allocSize = sizeof(struct DictItems);
dictitems->_ongcscan = _dictitems_gcscan;

View File

@ -25,8 +25,7 @@ static void _list_gcsweep(KrkInstance * self) {
}
/**
* Exposed method called to produce lists from [expr,...] sequences in managed code.
* Presented in the global namespace as listOf(...)
* Convenience constructor for the C API.
*/
KrkValue krk_list_of(int argc, const KrkValue argv[], int hasKw) {
KrkValue outList = OBJECT_VAL(krk_newInstance(vm.baseClasses->listClass));
@ -612,10 +611,6 @@ void _createAndBind_listClass(void) {
krk_finalizeClass(list);
KRK_DOC(list, "Mutable sequence of arbitrary values.");
BUILTIN_FUNCTION("listOf", krk_list_of,
"@brief Convert argument sequence to list object.\n"
"@arguments *args\n\n"
"Creates a list from the provided @p args.");
BUILTIN_FUNCTION("sorted", _sorted,
"@brief Return a sorted representation of an iterable.\n"
"@arguments iterable\n\n"

View File

@ -310,8 +310,6 @@ void _createAndBind_setClass(void) {
krk_attachNamedValue(&set->methods, "__hash__", NONE_VAL());
krk_finalizeClass(set);
BUILTIN_FUNCTION("setOf", krk_set_of, "Convert argument sequence to set object.");
krk_makeClass(vm.builtins, &setiterator, "setiterator", vm.baseClasses->objectClass);
setiterator->allocSize = sizeof(struct SetIterator);
setiterator->_ongcscan = _setiterator_gcscan;