forked from xxq250/Nasal-Interpreter
✨ add experimental namespace table
This commit is contained in:
@@ -2,10 +2,16 @@
|
||||
|
||||
bool symbol_finder::visit_definition_expr(definition_expr* node) {
|
||||
if (node->get_variable_name()) {
|
||||
symbols.push_back(node->get_variable_name()->get_name());
|
||||
symbols.push_back({
|
||||
node->get_variable_name()->get_name(),
|
||||
node->get_variable_name()->get_location().file
|
||||
});
|
||||
} else {
|
||||
for(auto i : node->get_variables()->get_variables()) {
|
||||
symbols.push_back(i->get_name());
|
||||
symbols.push_back({
|
||||
i->get_name(),
|
||||
i->get_location().file
|
||||
});
|
||||
}
|
||||
}
|
||||
if (node->get_tuple()) {
|
||||
@@ -22,12 +28,14 @@ bool symbol_finder::visit_function(function* node) {
|
||||
|
||||
bool symbol_finder::visit_iter_expr(iter_expr* node) {
|
||||
if (node->get_name()) {
|
||||
symbols.push_back(node->get_name()->get_name());
|
||||
symbols.push_back({
|
||||
node->get_name()->get_name(),
|
||||
node->get_name()->get_location().file});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& symbol_finder::do_find(code_block* root) {
|
||||
const std::vector<symbol_finder::symbol_info>& symbol_finder::do_find(code_block* root) {
|
||||
symbols.clear();
|
||||
root->accept(this);
|
||||
return symbols;
|
||||
|
||||
Reference in New Issue
Block a user