NewLang Project
Yet another programm language
Loading...
Searching...
No Matches
module.cpp
Go to the documentation of this file.
1#include "nlc-rt.h"
2#include "module.h"
3#include "context.h"
4
5using namespace newlang;
6
7//void Module::RegisterStaticObject(Module &module, TermPtr op, Context *ctx) {
8// ASSERT(op);
9//
10// if (op->isCreate() && Term::isExportName(op->m_left)) {
11// ASSERT(!op->m_left->m_normalized.empty());
12//
13// auto found = module.find(op->m_left->m_normalized);
14// if (found == module.end()) {
15//
16// LatterType obj;
22// obj = Context::EvalTerm(op->m_right, ctx, true);
29//
35//
36// } else {
37// if (op->isCreate()) {
38// LOG_RUNTIME("Object name '%s' (%s) already exist!", op->m_left->m_normalized.c_str(), op->m_left->toString().c_str());
39// }
40// }
41//
42// } else if (op->m_right) {
43// RegisterStaticObject(module, op->m_right, ctx);
44// }
45//
46// for (auto &elem : op->m_block) {
47// RegisterStaticObject(module, elem, ctx);
48// }
49//}
50
51Module::Module(RunTime *rt, TermPtr ast) : m_rt(rt), m_ast(ast) {//: Obj(ObjType::Module) {
52
53 if (ast) {
54
55 ASSERT(rt);
56
57// RegisterStaticObject(*this, ast, false);
58
59
60 // Только создание пустых объектов без их инициалиазации.
61 // Инициализация будет во время выполнения,
62 // а к тому времени все объекты должны быть уже созданы
63 // for (auto &var_mod : ast->m_variables) {
64 // ASSERT(var_mod.second);
78 //
79 //
80 // for (auto &var_local : var_mod.second->m_variables) {
81 //
94 // }
95 //
96 // }
97 }
98 // m_var_is_init = true;
99}
Module(RunTime *rt=nullptr, TermPtr ast=nullptr)
Definition module.cpp:51
#define ASSERT(condition)
Definition logger.h:60
Definition nlc.h:59
std::shared_ptr< Term > TermPtr
Definition variable.h:33