1
0
mirror of https://github.com/myhdl/myhdl.git synced 2024-12-14 07:44:38 +08:00

prepare _extractHierarchy for further patches

This commit is contained in:
Jan Decaluwe 2010-07-01 12:46:21 +02:00
parent 7c48c2e171
commit 1f79dd17f8

View File

@ -192,14 +192,18 @@ class _HierExtr(object):
if event == "call": if event == "call":
func_name = frame.f_code.co_name funcname = frame.f_code.co_name
if func_name in self.skipNames: # skip certain functions
self.skip = 1 if funcname in self.skipNames:
self.skip +=1
if not self.skip: if not self.skip:
self.level += 1 self.level += 1
elif event == "return": elif event == "return":
funcname = frame.f_code.co_name
func = frame.f_globals.get(funcname)
if not self.skip: if not self.skip:
isGenSeq = _isGenSeq(arg) isGenSeq = _isGenSeq(arg)
if isGenSeq: if isGenSeq:
@ -210,7 +214,6 @@ class _HierExtr(object):
namespace = frame.f_globals.copy() namespace = frame.f_globals.copy()
namespace.update(frame.f_locals) namespace.update(frame.f_locals)
sourcefile = inspect.getsourcefile(frame) sourcefile = inspect.getsourcefile(frame)
funcname = frame.f_code.co_name
sourceline = inspect.getsourcelines(frame)[1] sourceline = inspect.getsourcelines(frame)[1]
_addUserCode(hdl, arg, code, namespace, sourcefile, funcname, sourceline) _addUserCode(hdl, arg, code, namespace, sourcefile, funcname, sourceline)
# building hierarchy only makes sense if there are generators # building hierarchy only makes sense if there are generators
@ -246,9 +249,8 @@ class _HierExtr(object):
self.level -= 1 self.level -= 1
func_name = frame.f_code.co_name if funcname in self.skipNames:
if func_name in self.skipNames: self.skip -= 1
self.skip = 0
def _inferArgs(arg): def _inferArgs(arg):