Fix c++11 compatibility.
This commit is contained in:
parent
17c5486551
commit
d32d92e241
@ -145,7 +145,7 @@ namespace lily {
|
|||||||
public:
|
public:
|
||||||
template <typename T, typename ... Ts>
|
template <typename T, typename ... Ts>
|
||||||
T* add_instruction(Ts ... ts) {
|
T* add_instruction(Ts ... ts) {
|
||||||
auto new_inst = std::make_unique<T>(ts...);
|
auto new_inst = std::unique_ptr<T>(new T(ts...));
|
||||||
T* raw = new_inst.get();
|
T* raw = new_inst.get();
|
||||||
instructions.push_back(std::move(new_inst));
|
instructions.push_back(std::move(new_inst));
|
||||||
return raw;
|
return raw;
|
||||||
|
@ -216,7 +216,7 @@ namespace lily {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static program_ptr build_program(pgs_tree* tree, const char* source) {
|
static program_ptr build_program(pgs_tree* tree, const char* source) {
|
||||||
program_ptr prog = std::make_unique<program>();
|
program_ptr prog = std::unique_ptr<program>(new program);
|
||||||
pgs_tree* program = PGS_TREE_NT_CHILD(*tree, 0);
|
pgs_tree* program = PGS_TREE_NT_CHILD(*tree, 0);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
namespace lily {
|
namespace lily {
|
||||||
type_data::constructor* type_data::create_constructor(const std::string& name,
|
type_data::constructor* type_data::create_constructor(const std::string& name,
|
||||||
std::vector<type*>&& params) {
|
std::vector<type*>&& params) {
|
||||||
auto new_constructor = std::make_unique<constructor>();
|
auto new_constructor = std::unique_ptr<constructor>(new constructor());
|
||||||
new_constructor->id = constructors.size();
|
new_constructor->id = constructors.size();
|
||||||
new_constructor->parent = this;
|
new_constructor->parent = this;
|
||||||
new_constructor->params = std::move(params);
|
new_constructor->params = std::move(params);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace lily {
|
namespace lily {
|
||||||
enum reserved_types {
|
enum reserved_types {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include "type.hpp"
|
#include "type.hpp"
|
||||||
#include "ast.hpp"
|
#include "ast.hpp"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace lily {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type_internal* type_manager::create_int_type() {
|
type_internal* type_manager::create_int_type() {
|
||||||
auto new_type = std::make_unique<type_internal>(next_id++);
|
auto new_type = std::unique_ptr<type_internal>(new type_internal(next_id++));
|
||||||
type_internal* raw_ptr = new_type.get();
|
type_internal* raw_ptr = new_type.get();
|
||||||
types.push_back(std::move(new_type));
|
types.push_back(std::move(new_type));
|
||||||
type_names["Int"] = raw_ptr;
|
type_names["Int"] = raw_ptr;
|
||||||
@ -20,7 +20,7 @@ namespace lily {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type_internal* type_manager::create_str_type() {
|
type_internal* type_manager::create_str_type() {
|
||||||
auto new_type = std::make_unique<type_internal>(next_id++);
|
auto new_type = std::unique_ptr<type_internal>(new type_internal(next_id++));
|
||||||
type_internal* raw_ptr = new_type.get();
|
type_internal* raw_ptr = new_type.get();
|
||||||
types.push_back(std::move(new_type));
|
types.push_back(std::move(new_type));
|
||||||
type_names["Str"] = raw_ptr;
|
type_names["Str"] = raw_ptr;
|
||||||
@ -29,7 +29,7 @@ namespace lily {
|
|||||||
|
|
||||||
type_data* type_manager::create_data_type(const std::string& name) {
|
type_data* type_manager::create_data_type(const std::string& name) {
|
||||||
if(type_names.count(name)) throw error("redefinition of type");
|
if(type_names.count(name)) throw error("redefinition of type");
|
||||||
auto new_type = std::make_unique<type_data>(next_id++);
|
auto new_type = std::unique_ptr<type_data>(new type_data(next_id++));
|
||||||
type_data* raw_ptr = new_type.get();
|
type_data* raw_ptr = new_type.get();
|
||||||
types.push_back(std::move(new_type));
|
types.push_back(std::move(new_type));
|
||||||
type_names[name] = raw_ptr;
|
type_names[name] = raw_ptr;
|
||||||
|
@ -21,7 +21,7 @@ namespace lily {
|
|||||||
type_data* create_data_type(const std::string& name);
|
type_data* create_data_type(const std::string& name);
|
||||||
template <typename T, typename ... Args>
|
template <typename T, typename ... Args>
|
||||||
T* create_type(Args...as) {
|
T* create_type(Args...as) {
|
||||||
auto new_type = std::make_unique<T>(as...);
|
auto new_type = std::unique_ptr<T>(new T(as...));
|
||||||
T* raw_ptr = new_type.get();
|
T* raw_ptr = new_type.get();
|
||||||
types.push_back(std::move(new_type));
|
types.push_back(std::move(new_type));
|
||||||
return raw_ptr;
|
return raw_ptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user