remove some TODOs

This commit is contained in:
blueloveTH 2023-04-09 18:30:27 +08:00
parent e936f349a0
commit 5dcd7febe7
3 changed files with 1 additions and 5 deletions

View File

@ -934,7 +934,6 @@ public:
this->lexer = std::make_unique<Lexer>( this->lexer = std::make_unique<Lexer>(
make_sp<SourceData>(source, filename, mode) make_sp<SourceData>(source, filename, mode)
); );
// TODO: check if already initialized
init_pratt_rules(); init_pratt_rules();
} }

View File

@ -6,7 +6,6 @@
namespace pkpy { namespace pkpy {
// TODO: check error if return 0
inline int utf8len(unsigned char c, bool suppress=false){ inline int utf8len(unsigned char c, bool suppress=false){
if((c & 0b10000000) == 0) return 1; if((c & 0b10000000) == 0) return 1;
if((c & 0b11100000) == 0b11000000) return 2; if((c & 0b11100000) == 0b11000000) return 2;
@ -244,7 +243,6 @@ struct Str{
/*************unicode*************/ /*************unicode*************/
// TODO: check error
int _unicode_index_to_byte(int i) const{ int _unicode_index_to_byte(int i) const{
if(is_ascii) return i; if(is_ascii) return i;
int j = 0; int j = 0;

View File

@ -736,6 +736,7 @@ inline PyObject* VM::call(PyObject* callable, Args args, const Args& kwargs, boo
} }
if(is_type(callable, tp_type)){ if(is_type(callable, tp_type)){
// TODO: use get_unbound_method here
PyObject* new_f = callable->attr().try_get(__new__); PyObject* new_f = callable->attr().try_get(__new__);
PyObject* obj; PyObject* obj;
if(new_f != nullptr){ if(new_f != nullptr){
@ -776,7 +777,6 @@ inline void VM::unpack_args(Args& args){
// https://docs.python.org/3/howto/descriptor.html#invocation-from-an-instance // https://docs.python.org/3/howto/descriptor.html#invocation-from-an-instance
inline PyObject* VM::getattr(PyObject* obj, StrName name, bool throw_err){ inline PyObject* VM::getattr(PyObject* obj, StrName name, bool throw_err){
// TODO: class_only impl may not be correct
PyObject* objtype = _t(obj); PyObject* objtype = _t(obj);
// handle super() proxy // handle super() proxy
if(is_type(obj, tp_super)){ if(is_type(obj, tp_super)){
@ -810,7 +810,6 @@ inline PyObject* VM::getattr(PyObject* obj, StrName name, bool throw_err){
// try to load a unbound method (fallback to `getattr` if not found) // try to load a unbound method (fallback to `getattr` if not found)
inline PyObject* VM::get_unbound_method(PyObject* obj, StrName name, PyObject** self, bool throw_err, bool fallback){ inline PyObject* VM::get_unbound_method(PyObject* obj, StrName name, PyObject** self, bool throw_err, bool fallback){
*self = _py_null; *self = _py_null;
// TODO: class_only impl may not be correct
PyObject* objtype = _t(obj); PyObject* objtype = _t(obj);
// handle super() proxy // handle super() proxy
if(is_type(obj, tp_super)){ if(is_type(obj, tp_super)){