Permalink
Browse files
pyassem: Get rid of hasattr() check.
- Loading branch information...
Showing
with
3 additions
and
11 deletions.
-
+3
−2
opy/compiler2/pyassem.py
-
+0
−9
opy/compiler2/pycodegen.py
|
|
@@ -529,8 +529,9 @@ def __init__(self, klass, consts, names, varnames, closure): |
|
|
self.closure = closure
|
|
|
|
|
|
def _convert_LOAD_CONST(self, arg):
|
|
|
if hasattr(arg, 'getCode'):
|
|
|
arg = arg.getCode()
|
|
|
from . import pycodegen
|
|
|
if isinstance(arg, pycodegen.CodeGenerator):
|
|
|
arg = arg.graph.getCode()
|
|
|
return _NameToIndex(arg, self.consts)
|
|
|
|
|
|
def _convert_LOAD_FAST(self, arg):
|
|
|
|
|
|
@@ -197,15 +197,6 @@ def _setupGraphDelegation(self): |
|
|
self.nextBlock = self.graph.nextBlock
|
|
|
self.setDocstring = self.graph.setDocstring
|
|
|
|
|
|
def getCode(self):
|
|
|
"""Called by _convert_LOAD_CONST in pyassem in a weird way.
|
|
|
|
|
|
It checks hasattr(arg, 'getCode'). I guess that is the ad-hoc
|
|
|
polymorphism of things that can be serialized to code objects. Consts
|
|
|
can be code objects!
|
|
|
"""
|
|
|
return self.graph.getCode()
|
|
|
|
|
|
def mangle(self, name):
|
|
|
if self.class_name is not None:
|
|
|
return misc.mangle(name, self.class_name)
|
|
|
|
0 comments on commit
9c8486c