|
@ -0,0 +1,29 @@ |
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include "gp/dynamic/compiler/type/type.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct gr_variable { |
|
|
|
|
|
/// Its type.
|
|
|
|
|
|
gr_type type; |
|
|
|
|
|
/// Register position, separate for each type (int, float, string and objects);
|
|
|
|
|
|
size_t _register = std::numeric_limits<decltype(_register)>::max(); |
|
|
|
|
|
/// Declared from the global scope ?
|
|
|
|
|
|
bool is_global; |
|
|
|
|
|
/// Declared from an object definition ?
|
|
|
|
|
|
bool is_field; |
|
|
|
|
|
/// Does it have a value yet ?
|
|
|
|
|
|
bool is_initialized; |
|
|
|
|
|
/// Is the type to be infered automatically ? (e.g. the `let` keyword).
|
|
|
|
|
|
bool is_auto; |
|
|
|
|
|
/// Can we modify its value ?
|
|
|
|
|
|
bool is_constant; |
|
|
|
|
|
/// Its unique name inside its scope (function based scope).
|
|
|
|
|
|
string name; |
|
|
|
|
|
/// Is the variable visible from other files ? (Global only)
|
|
|
|
|
|
bool is_public; |
|
|
|
|
|
/// The file where the variable is declared.
|
|
|
|
|
|
size_t file_id; |
|
|
|
|
|
/// Position information in case of errors.
|
|
|
|
|
|
size_t lex_position; |
|
|
|
|
|
}; |