Browse Source

more division of things in dynamic

channel
Ludovic 'Archivist' Lagouardette 3 years ago
parent
commit
39d7c97984
2 changed files with 34 additions and 0 deletions
  1. +5
    -0
      include/gp/dynamic/compiler/type/decls.hpp
  2. +29
    -0
      include/gp/dynamic/compiler/type/variable.hpp

+ 5
- 0
include/gp/dynamic/compiler/type/decls.hpp View File

@ -0,0 +1,5 @@
#pragma once
enum class gr_base_type;
struct gr_type;
struct gr_variable;

+ 29
- 0
include/gp/dynamic/compiler/type/variable.hpp View File

@ -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;
};

Loading…
Cancel
Save