summaryrefslogtreecommitdiffstats
path: root/Lib/compiler/pycodegen.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-10-18 21:57:37 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-10-18 21:57:37 (GMT)
commite0c446bb4ad67294f42d4cb53b4ff28413bd8dde (patch)
treeb4f286b4e6f2259ec47569561c4c62762e78b3f2 /Lib/compiler/pycodegen.py
parent8a57f00081b6f83168007fc701447d7926acc6c4 (diff)
downloadcpython-e0c446bb4ad67294f42d4cb53b4ff28413bd8dde.zip
cpython-e0c446bb4ad67294f42d4cb53b4ff28413bd8dde.tar.gz
cpython-e0c446bb4ad67294f42d4cb53b4ff28413bd8dde.tar.bz2
Whitespace normalization.
Diffstat (limited to 'Lib/compiler/pycodegen.py')
-rw-r--r--Lib/compiler/pycodegen.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py
index 3cdf108..88767a4 100644
--- a/Lib/compiler/pycodegen.py
+++ b/Lib/compiler/pycodegen.py
@@ -36,7 +36,7 @@ END_FINALLY = 4
class BlockStack(misc.Stack):
__super_init = misc.Stack.__init__
-
+
def __init__(self):
self.__super_init(self)
self.loop = None
@@ -59,7 +59,7 @@ def compile(source, filename, mode, flags=None, dont_inherit=None):
"""Replacement for builtin compile() function"""
if flags is not None or dont_inherit is not None:
raise RuntimeError, "not implemented yet"
-
+
if mode == "single":
gen = Interactive(source, filename)
elif mode == "exec":
@@ -198,7 +198,7 @@ class CodeGenerator:
NameFinder, FunctionGen, and ClassGen. These attributes can be
defined in the initClass() method, which is a hook for
initializing these methods after all the classes have been
- defined.
+ defined.
"""
optimized = 0 # is namespace access optimized?
@@ -312,7 +312,7 @@ class CodeGenerator:
self.emit(prefix + '_NAME', name)
def set_lineno(self, node, force=0):
- """Emit SET_LINENO if node has lineno attribute and it is
+ """Emit SET_LINENO if node has lineno attribute and it is
different than the last lineno emitted.
Returns true if SET_LINENO was emitted.
@@ -513,7 +513,7 @@ class CodeGenerator:
self.emit('CONTINUE_LOOP', loop_block)
self.nextBlock()
elif kind == END_FINALLY:
- msg = "'continue' not allowed inside 'finally' clause (%s, %d)"
+ msg = "'continue' not allowed inside 'finally' clause (%s, %d)"
raise SyntaxError, msg % (node.filename, node.lineno)
def visitTest(self, node, jump):
@@ -558,7 +558,7 @@ class CodeGenerator:
# list comprehensions
__list_count = 0
-
+
def visitListComp(self, node):
self.set_lineno(node)
# setup list
@@ -568,7 +568,7 @@ class CodeGenerator:
self.emit('DUP_TOP')
self.emit('LOAD_ATTR', 'append')
self._implicitNameOp('STORE', append)
-
+
stack = []
for i, for_ in zip(range(len(node.quals)), node.quals):
start, anchor = self.visit(for_)
@@ -583,7 +583,7 @@ class CodeGenerator:
self.visit(node.expr)
self.emit('CALL_FUNCTION', 1)
self.emit('POP_TOP')
-
+
for start, cont, anchor in stack:
if cont:
skip_one = self.newBlock()
@@ -594,7 +594,7 @@ class CodeGenerator:
self.emit('JUMP_ABSOLUTE', start)
self.startBlock(anchor)
self._implicitNameOp('DELETE', append)
-
+
self.__list_count = self.__list_count - 1
def visitListCompFor(self, node):
@@ -675,7 +675,7 @@ class CodeGenerator:
self.setups.pop()
self.emit('JUMP_FORWARD', lElse)
self.startBlock(handlers)
-
+
last = len(node.handlers) - 1
for i in range(len(node.handlers)):
expr, target, body = node.handlers[i]
@@ -707,7 +707,7 @@ class CodeGenerator:
self.nextBlock(lElse)
self.visit(node.else_)
self.nextBlock(end)
-
+
def visitTryFinally(self, node):
body = self.newBlock()
final = self.newBlock()
@@ -746,7 +746,7 @@ class CodeGenerator:
def visitName(self, node):
self.set_lineno(node)
self.loadName(node.name)
-
+
def visitPass(self, node):
self.set_lineno(node)
@@ -1139,7 +1139,7 @@ class ModuleCodeGenerator(NestedScopeMixin, CodeGenerator):
__super_init = CodeGenerator.__init__
scopes = None
-
+
def __init__(self, tree):
self.graph = pyassem.PyFlowGraph("<module>", tree.filename)
self.futures = future.find_futures(tree)
@@ -1154,7 +1154,7 @@ class ExpressionCodeGenerator(NestedScopeMixin, CodeGenerator):
scopes = None
futures = ()
-
+
def __init__(self, tree):
self.graph = pyassem.PyFlowGraph("<expression>", tree.filename)
self.__super_init()
@@ -1171,7 +1171,7 @@ class InteractiveCodeGenerator(NestedScopeMixin, CodeGenerator):
scopes = None
futures = ()
-
+
def __init__(self, tree):
self.graph = pyassem.PyFlowGraph("<interactive>", tree.filename)
self.__super_init()
@@ -1201,8 +1201,8 @@ class AbstractFunctionCode:
else:
name = func.name
args, hasTupleArg = generateArgList(func.argnames)
- self.graph = pyassem.PyFlowGraph(name, func.filename, args,
- optimized=1)
+ self.graph = pyassem.PyFlowGraph(name, func.filename, args,
+ optimized=1)
self.isLambda = isLambda
self.super_init()
@@ -1234,7 +1234,7 @@ class AbstractFunctionCode:
if type(arg) == types.TupleType:
self.emit('LOAD_FAST', '.%d' % (i * 2))
self.unpackSequence(arg)
-
+
def unpackSequence(self, tup):
if VERSION > 1:
self.emit('UNPACK_SEQUENCE', len(tup))
@@ -1249,7 +1249,7 @@ class AbstractFunctionCode:
unpackTuple = unpackSequence
class FunctionCodeGenerator(NestedScopeMixin, AbstractFunctionCode,
- CodeGenerator):
+ CodeGenerator):
super_init = CodeGenerator.__init__ # call be other init
scopes = None