1
0
forked from VimPlug/jedi

adding helpers.FakeName and other fakes to make it easier to fake parser names and statements

This commit is contained in:
Dave Halter
2014-01-11 13:41:03 +01:00
parent 6f9d834a93
commit fc35e69a16
4 changed files with 24 additions and 23 deletions

View File

@@ -24,16 +24,10 @@ class Generator(use_metaclass(CachedMetaClass, pr.Base)):
content of a generator.
"""
names = []
none_pos = (0, 0)
executes_generator = ('__next__', 'send')
for n in ('close', 'throw') + executes_generator:
name = pr.Name(compiled.builtin, [(n, none_pos)],
none_pos, none_pos)
if n in executes_generator:
name.parent = self
else:
name.parent = compiled.builtin
names.append(name)
parent = self if n in executes_generator else compiled.builtin
names.append(helpers.FakeName(n, parent))
debug.dbg('generator names', names)
return names