mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
fix a bug
This commit is contained in:
parent
1eb3ba3077
commit
17cdeffbf5
@ -56,7 +56,7 @@ struct CodeEmitContext{
|
|||||||
int for_loop_depth = 0;
|
int for_loop_depth = 0;
|
||||||
|
|
||||||
std::map<void*, int> _co_consts_nonstring_dedup_map;
|
std::map<void*, int> _co_consts_nonstring_dedup_map;
|
||||||
std::map<std::string_view, int> _co_consts_string_dedup_map;
|
std::map<std::string, int> _co_consts_string_dedup_map;
|
||||||
|
|
||||||
int get_loop() const;
|
int get_loop() const;
|
||||||
CodeBlock* enter_block(CodeBlockType type);
|
CodeBlock* enter_block(CodeBlockType type);
|
||||||
|
@ -89,7 +89,7 @@ namespace pkpy{
|
|||||||
int CodeEmitContext::add_const(PyObject* v){
|
int CodeEmitContext::add_const(PyObject* v){
|
||||||
if(is_non_tagged_type(v, vm->tp_str)){
|
if(is_non_tagged_type(v, vm->tp_str)){
|
||||||
// string deduplication
|
// string deduplication
|
||||||
std::string_view key = PK_OBJ_GET(Str, v).sv();
|
std::string key = PK_OBJ_GET(Str, v).str();
|
||||||
auto it = _co_consts_string_dedup_map.find(key);
|
auto it = _co_consts_string_dedup_map.find(key);
|
||||||
if(it != _co_consts_string_dedup_map.end()){
|
if(it != _co_consts_string_dedup_map.end()){
|
||||||
return it->second;
|
return it->second;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user