Commit e693cca4 authored by Kevin Modzelewski's avatar Kevin Modzelewski Committed by Travis Hance

Have type analysis use new scoping API

parent 29ac7b5e
......@@ -394,7 +394,9 @@ private:
}
void* visit_name(AST_Name* node) override {
if (scope_info->refersToGlobal(node->id)) {
auto name_scope = scope_info->getScopeTypeOfName(node->id);
if (name_scope == ScopeInfo::VarScopeType::GLOBAL) {
if (node->id.str() == "xrange") {
// printf("TODO guard here and return the classobj\n");
// return typeOfClassobj(xrange_cls);
......@@ -402,10 +404,19 @@ private:
return UNKNOWN;
}
if (scope_info->refersToClosure(node->id)) {
if (name_scope == ScopeInfo::VarScopeType::CLOSURE) {
return UNKNOWN;
}
if (name_scope == ScopeInfo::VarScopeType::NAME) {
return UNKNOWN;
}
if (name_scope == ScopeInfo::VarScopeType::DEREF) {
return UNKNOWN;
}
if (name_scope == ScopeInfo::VarScopeType::FAST) {
CompilerType*& t = sym_table[node->id];
if (t == NULL) {
// if (VERBOSITY() >= 2) {
......@@ -417,6 +428,9 @@ private:
return t;
}
RELEASE_ASSERT(0, "Unknown scope type: %d", (int)name_scope);
}
void* visit_num(AST_Num* node) override {
switch (node->num_type) {
case AST_Num::INT:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment