Make env a class.
This commit is contained in:
		
							parent
							
								
									ba418d357f
								
							
						
					
					
						commit
						f2f88ab9ca
					
				@ -2,7 +2,8 @@
 | 
				
			|||||||
#include <memory>
 | 
					#include <memory>
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct env {
 | 
					class env {
 | 
				
			||||||
 | 
					    public:
 | 
				
			||||||
        virtual ~env() = default;
 | 
					        virtual ~env() = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        virtual int get_offset(const std::string& name) const = 0;
 | 
					        virtual int get_offset(const std::string& name) const = 0;
 | 
				
			||||||
@ -11,10 +12,12 @@ struct env {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
using env_ptr = std::shared_ptr<env>;
 | 
					using env_ptr = std::shared_ptr<env>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct env_var : public env {
 | 
					class env_var : public env {
 | 
				
			||||||
 | 
					    private:
 | 
				
			||||||
        std::string name;
 | 
					        std::string name;
 | 
				
			||||||
        env_ptr parent;
 | 
					        env_ptr parent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public:
 | 
				
			||||||
        env_var(std::string n, env_ptr p)
 | 
					        env_var(std::string n, env_ptr p)
 | 
				
			||||||
            : name(std::move(n)), parent(std::move(p)) {}
 | 
					            : name(std::move(n)), parent(std::move(p)) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -22,10 +25,12 @@ struct env_var : public env {
 | 
				
			|||||||
        bool has_variable(const std::string& name) const;
 | 
					        bool has_variable(const std::string& name) const;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct env_offset : public env {
 | 
					class env_offset : public env {
 | 
				
			||||||
 | 
					    private:
 | 
				
			||||||
        int offset;
 | 
					        int offset;
 | 
				
			||||||
        env_ptr parent;
 | 
					        env_ptr parent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public:
 | 
				
			||||||
        env_offset(int o, env_ptr p)
 | 
					        env_offset(int o, env_ptr p)
 | 
				
			||||||
            : offset(o), parent(std::move(p)) {}
 | 
					            : offset(o), parent(std::move(p)) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user