mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-05 22:48:42 +00:00
part of execute_visitor, fixes
This commit is contained in:
parent
359a65310b
commit
fcff4f9103
7 changed files with 249 additions and 65 deletions
|
|
@ -140,6 +140,7 @@ private:
|
|||
void Visit(BoolLiteral* node) override;
|
||||
|
||||
bool HandleCondition(Expression& condition, const BaseNode& base_node);
|
||||
void CollectTypeContext(const ParametrizedType& type);
|
||||
|
||||
template<typename T>
|
||||
T* ExtractValue(utils::IdType value, const BaseNode& base_node) {
|
||||
|
|
@ -167,6 +168,7 @@ private:
|
|||
utils::IdType current_value_;
|
||||
std::optional<LoopControlExpression> active_loop_control_expression_;
|
||||
std::optional<utils::IdType> return_value_; // TODO: work outside block ??
|
||||
std::optional<utils::IsConstModifier> is_const_definition_;
|
||||
};
|
||||
|
||||
} // namespace interpreter
|
||||
|
|
|
|||
|
|
@ -501,6 +501,7 @@ struct BinaryOperatorExpression {
|
|||
SubExpression right_expression;
|
||||
|
||||
utils::IdType function_id_;
|
||||
bool is_method_ = false;
|
||||
};
|
||||
|
||||
struct UnaryOperatorExpression {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace utils {
|
||||
|
|
@ -10,6 +11,8 @@ using std::size_t;
|
|||
|
||||
using IdType = size_t;
|
||||
|
||||
const std::string ClassInternalVarName = "self";
|
||||
|
||||
enum class ReferenceModifier { Reference = 0, UniqueReference = 1 };
|
||||
enum class IsConstModifier { Const = 0, Var = 1 };
|
||||
enum class ClassModifier { Struct = 0, Class = 1 };
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@ public:
|
|||
struct VariantValue {
|
||||
public:
|
||||
VariantValue() = default;
|
||||
VariantValue(TupleValue value) // TODO: add type & constructor??
|
||||
VariantValue(utils::IdType value) // TupleValue ?? // TODO: add type & constructor??
|
||||
: value(value) {}
|
||||
|
||||
public:
|
||||
TupleValue value;
|
||||
utils::IdType value;
|
||||
};
|
||||
|
||||
struct ReferenceToValue {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue