Commit a71c83a1 authored by Damien George's avatar Damien George
Browse files

Change mp_obj_type_t.name from const char * to qstr.

Ultimately all static strings should be qstr.  This entry in the type
structure is only used for printing error messages (to tell the type of
the bad argument), and printing objects that don't supply a .print method.
parent 8ac72b9d
......@@ -71,7 +71,7 @@ static const mp_method_t led_methods[] = {
static const mp_obj_type_t led_obj_type = {
{ &mp_const_type },
"Led",
.name = MP_QSTR_Led,
.print = led_obj_print,
.methods = led_methods,
};
......
......@@ -190,7 +190,7 @@ static const mp_method_t servo_methods[] = {
static const mp_obj_type_t servo_obj_type = {
{ &mp_const_type },
"Servo",
.name = MP_QSTR_Servo,
.print = servo_obj_print,
.methods = servo_methods,
};
......
......@@ -116,7 +116,7 @@ static const mp_method_t rawfile_type_methods[] = {
static const mp_obj_type_t rawfile_type = {
{ &mp_const_type },
"io.FileIO",
.name = MP_QSTR_io_dot_FileIO,
.print = fdfile_print,
.make_new = fdfile_make_new,
.getiter = mp_identity,
......
......@@ -195,7 +195,7 @@ static const mp_method_t test_methods[] = {
static const mp_obj_type_t test_type = {
{ &mp_const_type },
"Test",
.name = MP_QSTR_Test,
.print = test_print,
.methods = test_methods,
};
......@@ -308,7 +308,7 @@ int main(int argc, char **argv) {
// test_obj = TestClass()
// test_obj.attr = 42
mp_obj_t test_class_type, test_class_instance;
test_class_type = mp_obj_new_type("TestClass", mp_const_empty_tuple, mp_obj_new_dict(0));
test_class_type = mp_obj_new_type(QSTR_FROM_STR_STATIC("TestClass"), mp_const_empty_tuple, mp_obj_new_dict(0));
rt_store_name(QSTR_FROM_STR_STATIC("test_obj"), test_class_instance = rt_call_function_0(test_class_type));
rt_store_attr(test_class_instance, QSTR_FROM_STR_STATIC("attr"), mp_obj_new_int(42));
......
// qstrs specific to this port
Q(Test)
Q(argv)
Q(open)
Q(stdin)
......@@ -13,3 +15,5 @@ Q(inet_aton)
Q(gethostbyname)
Q(getaddrinfo)
Q(microsocket)
Q(io.FileIO)
......@@ -238,7 +238,7 @@ static const mp_method_t microsocket_type_methods[] = {
static const mp_obj_type_t microsocket_type = {
{ &mp_const_type },
"socket",
.name = MP_QSTR_socket,
.print = socket_print,
.make_new = socket_make_new,
.getiter = NULL,
......
......@@ -4,4 +4,6 @@ Q(argv)
Q(open)
Q(stdin)
Q(stdout)
Q(stderr)
\ No newline at end of file
Q(stderr)
Q(io.FileIO)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment