fix seg fault when callng a function with not enough parameters
This commit is contained in:
@@ -16,11 +16,11 @@ typedef enum {
|
||||
__base__,
|
||||
__class__,
|
||||
__name__,
|
||||
__binding__,
|
||||
__function__,
|
||||
|
||||
BUILT_IN_ARRAY_COUNT,
|
||||
|
||||
__binding__,
|
||||
__function__,
|
||||
__add__,
|
||||
__string__,
|
||||
__subtract__,
|
||||
|
||||
@@ -121,6 +121,7 @@ void run_call(ArgonObject *original_object, size_t argc, ArgonObject **argv,
|
||||
(int)object_name->value.as_str->length,
|
||||
object_name->value.as_str->data,
|
||||
object->value.argon_fn->number_of_parameters, argc);
|
||||
return;
|
||||
}
|
||||
Stack *scope = create_scope(object->value.argon_fn->stack, true);
|
||||
for (size_t i = 0; i < argc; i++) {
|
||||
|
||||
@@ -35,6 +35,8 @@ const char *built_in_field_names[BUILT_IN_FIELDS_COUNT] = {
|
||||
"__class__",
|
||||
"__name__",
|
||||
"", // above is anything that gets stored in built in slots
|
||||
"__binding__",
|
||||
"__function__",
|
||||
"__add__",
|
||||
"__string__",
|
||||
"__subtract__",
|
||||
@@ -44,8 +46,6 @@ const char *built_in_field_names[BUILT_IN_FIELDS_COUNT] = {
|
||||
"__init__",
|
||||
"__boolean__",
|
||||
"__get_attr__",
|
||||
"__binding__",
|
||||
"__function__",
|
||||
"address",
|
||||
"__call__",
|
||||
"__number__",
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
extern ArgonObject *BASE_CLASS;
|
||||
|
||||
extern const char *built_in_field_names[BUILT_IN_FIELDS_COUNT];
|
||||
|
||||
typedef struct ArgonObject ArgonObject;
|
||||
|
||||
ArgonObject *new_class();
|
||||
|
||||
@@ -615,7 +615,6 @@ void bootstrap_types() {
|
||||
add_builtin_field(ARGON_METHOD_TYPE, __base__, BASE_CLASS);
|
||||
add_builtin_field(ARGON_METHOD_TYPE, __name__,
|
||||
new_string_object_null_terminated("method"));
|
||||
create_ARGON_NUMBER_TYPE();
|
||||
|
||||
add_builtin_field(
|
||||
BASE_CLASS, __new__,
|
||||
@@ -695,6 +694,7 @@ void bootstrap_types() {
|
||||
BASE_CLASS, __set_attr__,
|
||||
create_argon_native_function("__set_attr__", BASE_CLASS___set_attr__));
|
||||
create_ARGON_DICTIONARY_TYPE();
|
||||
create_ARGON_NUMBER_TYPE();
|
||||
}
|
||||
|
||||
void add_to_hashmap(struct hashmap_GC *hashmap, char *name, ArgonObject *value) {
|
||||
|
||||
Reference in New Issue
Block a user