Using Pointer type instead of std::unique_ptr

For now, it's just an alias.
This commit is contained in:
Stefano Sanfilippo 2014-11-28 19:40:47 +01:00
parent 015f8ae6d1
commit 262508fafd

View File

@ -16,6 +16,10 @@ enum class Type {
}; };
template <class T>
using Pointer = std::unique_ptr<T>;
class Emittable { class Emittable {
public: public:
virtual void emit(std::ostream &stream, int indent = 0) = 0; virtual void emit(std::ostream &stream, int indent = 0) = 0;
@ -95,7 +99,7 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<std::string> value; Pointer<std::string> value;
}; };
@ -135,7 +139,7 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<Expression> expression; Pointer<Expression> expression;
}; };
@ -145,8 +149,8 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<StatementList> body; Pointer<StatementList> body;
std::unique_ptr<Expression> condition; Pointer<Expression> condition;
}; };
@ -157,9 +161,9 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<Id> name; Pointer<Id> name;
bool point; bool point;
std::unique_ptr<Expression> init; Pointer<Expression> init;
Type type; Type type;
}; };
@ -170,8 +174,8 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<Id> name; Pointer<Id> name;
std::unique_ptr<Expression> value; Pointer<Expression> value;
}; };
@ -181,7 +185,7 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<Expression> expression; Pointer<Expression> expression;
}; };
@ -191,7 +195,7 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<Id> variable; Pointer<Id> variable;
}; };
@ -207,7 +211,7 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<Expression> expression; Pointer<Expression> expression;
}; };
@ -217,8 +221,8 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<Id> name; Pointer<Id> name;
std::unique_ptr<ExpressionList> args; Pointer<ExpressionList> args;
}; };
@ -229,8 +233,8 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<SemiExpression> condition; Pointer<SemiExpression> condition;
std::unique_ptr<StatementList> body; Pointer<StatementList> body;
}; };
@ -244,9 +248,9 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<Id> var; Pointer<Id> var;
std::unique_ptr<BranchCaseList> cases; Pointer<BranchCaseList> cases;
std::unique_ptr<StatementList> els; Pointer<StatementList> els;
}; };
@ -256,7 +260,7 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<StatementList> body; Pointer<StatementList> body;
}; };
@ -269,9 +273,9 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
private: private:
std::unique_ptr<Id> name; Pointer<Id> name;
std::unique_ptr<IdList> args; Pointer<IdList> args;
std::unique_ptr<StatementList> body; Pointer<StatementList> body;
}; };
class Program: public Emittable { class Program: public Emittable {
@ -279,7 +283,7 @@ public:
virtual void emit(std::ostream &stream, int indent = 0); virtual void emit(std::ostream &stream, int indent = 0);
void setMain(Main *m) { void setMain(Main *m) {
main = std::unique_ptr<Main>(m); main = Pointer<Main>(m);
} }
void addFunction(Function *f) { void addFunction(Function *f) {
@ -287,7 +291,7 @@ public:
} }
private: private:
std::unique_ptr<Main> main; Pointer<Main> main;
PointerList<Function> functions; PointerList<Function> functions;
}; };
@ -301,8 +305,8 @@ protected:
virtual std::string getSym() = 0; virtual std::string getSym() = 0;
private: private:
std::unique_ptr<Expression> left; Pointer<Expression> left;
std::unique_ptr<Expression> right; Pointer<Expression> right;
}; };
@ -425,7 +429,7 @@ protected:
virtual std::string getSym() = 0; virtual std::string getSym() = 0;
private: private:
std::unique_ptr<Expression> left; Pointer<Expression> left;
}; };