diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-02-09 22:20:56 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-02-09 22:20:56 +0100 |
commit | 269f28df980f34895c3c7181140963b4a86a1afc (patch) | |
tree | 883e0365462e7d33f9a772f2ebba327d2e6dd483 /evaluate.h | |
parent | 6c56e7209fc82888cb7a8c85c38ff5c3479cefbb (diff) |
Split the Scope types, and generic ref/unref
Diffstat (limited to 'evaluate.h')
-rw-r--r-- | evaluate.h | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -1,11 +1,14 @@ #pragma once #include <string> +#include <unordered_map> #include "ast.h" using namespace std; +class ScopeVal; + class Value{ public: enum class Type{ @@ -17,21 +20,26 @@ public: Type type; double numval; string strval; - Scope scope; + ScopeVal *scope; Value(double numval); Value(const string &strval); - Value(const Scope &scope); + Value(ScopeVal *scope); +}; + +class ScopeVal{ +public: + unordered_map<string,Value> values; }; namespace A { - template <typename ...Args> - Value* ref_create(Args... args); + template <typename T> + T* ref(T *value); - Value* ref(Value *value); - void unref(Value *value); + template <typename T> + void unref(T *value); } |