summaryrefslogtreecommitdiff
path: root/evaluate.h
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-02-09 22:20:56 +0100
committertomsmeding <tom.smeding@gmail.com>2017-02-09 22:20:56 +0100
commit269f28df980f34895c3c7181140963b4a86a1afc (patch)
tree883e0365462e7d33f9a772f2ebba327d2e6dd483 /evaluate.h
parent6c56e7209fc82888cb7a8c85c38ff5c3479cefbb (diff)
Split the Scope types, and generic ref/unref
Diffstat (limited to 'evaluate.h')
-rw-r--r--evaluate.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/evaluate.h b/evaluate.h
index 09d0c81..9c50b24 100644
--- a/evaluate.h
+++ b/evaluate.h
@@ -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);
}