blueloveTH hace 3 años
padre
commit
3f5842092f
Se han modificado 4 ficheros con 13 adiciones y 13 borrados
  1. 6 6
      src/compiler.h
  2. 1 1
      src/error.h
  3. 2 2
      src/obj.h
  4. 4 4
      src/str.h

+ 6 - 6
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<Parser>(
-            std::make_shared<SourceMetadata>(source, filename, mode)
+            pkpy::make_shared<SourceMetadata>(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<Function>();
+        _Func func = pkpy::make_shared<Function>();
         func->name = "<lambda>";
         if(!match(TK(":"))){
             __compileFunctionArgs(func);
             consume(TK(":"));
         }
-        func->code = std::make_shared<CodeObject>(parser->src, func->name);
+        func->code = pkpy::make_shared<CodeObject>(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<Function>();
+        _Func func = pkpy::make_shared<Function>();
         consume(TK("@id"));
         func->name = parser->previous.str();
 
@@ -933,7 +933,7 @@ __LISTCOMP:
             consume(TK(")"));
         }
 
-        func->code = std::make_shared<CodeObject>(parser->src, func->name);
+        func->code = pkpy::make_shared<CodeObject>(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<CodeObject>(parser->src, _Str("<module>"));
+        _Code code = pkpy::make_shared<CodeObject>(parser->src, _Str("<module>"));
         codes.push(code);
 
         // Lex initial tokens. current <-- next.

+ 1 - 1
src/error.h

@@ -53,7 +53,7 @@ struct SourceMetadata {
     }
 };
 
-typedef std::shared_ptr<SourceMetadata> _Source;
+typedef pkpy::shared_ptr<SourceMetadata> _Source;
 
 class _Error : public std::exception {
 private:

+ 2 - 2
src/obj.h

@@ -12,7 +12,7 @@ class Frame;
 
 typedef pkpy::shared_ptr<const BasePointer> _Pointer;
 typedef PyVar (*_CppFunc)(VM*, const pkpy::ArgList&);
-typedef std::shared_ptr<CodeObject> _Code;
+typedef pkpy::shared_ptr<CodeObject> _Code;
 
 struct Function {
     _Str name;
@@ -64,7 +64,7 @@ public:
     _Iterator(VM* vm, PyVar _ref) : vm(vm), _ref(_ref) {}
 };
 
-typedef std::shared_ptr<Function> _Func;
+typedef pkpy::shared_ptr<Function> _Func;
 typedef std::variant<PyVar,_Int,_Float,bool,_Str,PyVarList,_CppFunc,_Func,std::shared_ptr<_Iterator>,_BoundedMethod,_Range,_Slice,_Pointer> _Value;
 
 const int _SIZEOF_VALUE = sizeof(_Value);

+ 4 - 4
src/str.h

@@ -55,7 +55,7 @@ public:
 };
 
 
-std::map<std::string, std::shared_ptr<_StrMemory>, std::less<>> _strIntern;
+std::map<std::string, pkpy::shared_ptr<_StrMemory>, 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));
         }
     }