Implements complex tables
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <string>
|
||||
#include "EvalValue.hpp"
|
||||
#include "../../Utilities/HashedString.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -14,8 +15,8 @@ class StringEvalValue : public EvalValue{
|
||||
public:
|
||||
explicit StringEvalValue(string s){
|
||||
_value = move(s);
|
||||
_type = std::make_shared<ScriptType>(TypeClass::String);
|
||||
_hash = std::hash<string>{}(_value);
|
||||
_hash = HashedString::ConstHash (_value.c_str());
|
||||
_type = std::make_shared<StringScriptType>(true, _hash);
|
||||
}
|
||||
|
||||
std::shared_ptr<ScriptType> GetType() final{
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#include <utility>
|
||||
|
||||
#ifndef PORYGONLANG_TABLEEVALVALUE_HPP
|
||||
#define PORYGONLANG_TABLEEVALVALUE_HPP
|
||||
#include <utility>
|
||||
@@ -45,6 +43,11 @@ public:
|
||||
auto hash = val->GetHashCode();
|
||||
return this -> _table->at(hash);
|
||||
}
|
||||
|
||||
shared_ptr<EvalValue> IndexValue(const char* val){
|
||||
auto hash = HashedString::ConstHash(val);
|
||||
return this -> _table -> at(hash);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user