fixed None type appearances in CompiledObject

This commit is contained in:
Dave Halter
2014-01-24 00:57:53 +01:00
parent e587b876b6
commit 3d7522dff6
2 changed files with 5 additions and 2 deletions

View File

@@ -305,7 +305,7 @@ class Evaluator(object):
if isinstance(obj, iterable.GeneratorMethod): if isinstance(obj, iterable.GeneratorMethod):
return obj.execute() return obj.execute()
if obj.isinstance(compiled.CompiledObject): elif obj.isinstance(compiled.CompiledObject):
if obj.is_executable_class(): if obj.is_executable_class():
return [er.Instance(self, obj, params)] return [er.Instance(self, obj, params)]
else: else:

View File

@@ -87,6 +87,7 @@ class CompiledObject(Base):
def execute_function(self, evaluator, params): def execute_function(self, evaluator, params):
if self.type() != 'def': if self.type() != 'def':
return return
for name in self._parse_function_doc()[1].split(): for name in self._parse_function_doc()[1].split():
try: try:
bltn_obj = _create_from_name(builtin, builtin, name) bltn_obj = _create_from_name(builtin, builtin, name)
@@ -94,7 +95,9 @@ class CompiledObject(Base):
continue continue
else: else:
if isinstance(bltn_obj, CompiledObject): if isinstance(bltn_obj, CompiledObject):
yield bltn_obj # We want everything except None.
if bltn_obj.obj is not None:
yield bltn_obj
else: else:
for result in evaluator.execute(bltn_obj, params): for result in evaluator.execute(bltn_obj, params):
yield result yield result