Commit 1276f395 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #390 from undingen/typeanalysis_fix

Mangle functiondef and classdef names in the type analysis
parents 7212a261 2606f3b9
......@@ -522,7 +522,7 @@ private:
// TODO should we speculate that classdefs will generally return a class?
// CompilerType* t = typeFromClass(type_cls);
CompilerType* t = UNKNOWN;
_doSet(node->name, t);
_doSet(scope_info->mangleName(node->name), t);
}
void visit_delete(AST_Delete* node) override {
......@@ -559,7 +559,10 @@ private:
getType(d);
}
_doSet(node->name, typeFromClass(function_cls));
CompilerType* t = UNKNOWN;
if (node->decorator_list.empty())
t = typeFromClass(function_cls);
_doSet(scope_info->mangleName(node->name), t);
}
void visit_global(AST_Global* node) override {}
......
......@@ -156,3 +156,13 @@ print _MyClass._MyClass__a
class ___(object):
__a = 2
print ___.__a
# this fails if the type analysis does not mangle the function name
class C():
def f():
def __f2():
print "hi"
if 1:
pass
f()
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