diff --git a/src/compiler.h b/src/compiler.h index 560d48c8..dc4be02d 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -46,7 +46,7 @@ public: Compiler(VM* vm, const char* source, _Str filename, CompileMode mode){ this->vm = vm; this->parser = std::make_unique( - std::make_shared(source, filename, mode) + pkpy::make_shared(source, filename, mode) ); // http://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/ @@ -357,13 +357,13 @@ public: } void exprLambda() { - _Func func = std::make_shared(); + _Func func = pkpy::make_shared(); func->name = ""; if(!match(TK(":"))){ __compileFunctionArgs(func); consume(TK(":")); } - func->code = std::make_shared(parser->src, func->name); + func->code = pkpy::make_shared(parser->src, func->name); this->codes.push(func->code); EXPR_TUPLE(); emitCode(OP_RETURN_VALUE); @@ -924,7 +924,7 @@ __LISTCOMP: if(match(TK("pass"))) return; consume(TK("def")); } - _Func func = std::make_shared(); + _Func func = pkpy::make_shared(); consume(TK("@id")); func->name = parser->previous.str(); @@ -933,7 +933,7 @@ __LISTCOMP: consume(TK(")")); } - func->code = std::make_shared(parser->src, func->name); + func->code = pkpy::make_shared(parser->src, func->name); this->codes.push(func->code); compileBlockBody(); this->codes.pop(); @@ -971,7 +971,7 @@ __LISTCOMP: } _Code __fillCode(){ - _Code code = std::make_shared(parser->src, _Str("")); + _Code code = pkpy::make_shared(parser->src, _Str("")); codes.push(code); // Lex initial tokens. current <-- next. diff --git a/src/error.h b/src/error.h index c436d14f..a66f8ecf 100644 --- a/src/error.h +++ b/src/error.h @@ -53,7 +53,7 @@ struct SourceMetadata { } }; -typedef std::shared_ptr _Source; +typedef pkpy::shared_ptr _Source; class _Error : public std::exception { private: diff --git a/src/obj.h b/src/obj.h index b5eed26a..f0ba7fcf 100644 --- a/src/obj.h +++ b/src/obj.h @@ -12,7 +12,7 @@ class Frame; typedef pkpy::shared_ptr _Pointer; typedef PyVar (*_CppFunc)(VM*, const pkpy::ArgList&); -typedef std::shared_ptr _Code; +typedef pkpy::shared_ptr _Code; struct Function { _Str name; @@ -64,7 +64,7 @@ public: _Iterator(VM* vm, PyVar _ref) : vm(vm), _ref(_ref) {} }; -typedef std::shared_ptr _Func; +typedef pkpy::shared_ptr _Func; typedef std::variant,_BoundedMethod,_Range,_Slice,_Pointer> _Value; const int _SIZEOF_VALUE = sizeof(_Value); diff --git a/src/str.h b/src/str.h index b69e1a33..274315b5 100644 --- a/src/str.h +++ b/src/str.h @@ -55,7 +55,7 @@ public: }; -std::map, std::less<>> _strIntern; +std::map, std::less<>> _strIntern; class _StrLiteral : public std::string_view { @@ -69,7 +69,7 @@ inline constexpr _StrLiteral operator "" _c(const char* str, size_t len){ class _Str { private: - std::shared_ptr<_StrMemory> _s; + pkpy::shared_ptr<_StrMemory> _s; bool interned = false; public: _Str(const _StrLiteral& s){ @@ -92,7 +92,7 @@ public: // for move constructor, we do not check if the string is interned!! _Str(std::string&& s){ - this->_s = std::make_shared<_StrMemory>(std::move(s)); + this->_s = pkpy::make_shared<_StrMemory>(std::move(s)); } void construct(const std::string_view& sv){ @@ -101,7 +101,7 @@ public: this->_s = it->second; interned = true; }else{ - this->_s = std::make_shared<_StrMemory>(std::string(sv)); + this->_s = pkpy::make_shared<_StrMemory>(std::string(sv)); } }