Permalink
Browse files

Update golden checksums, and minor refactoring.

  • Loading branch information...
Andy Chu
Andy Chu committed Mar 21, 2018
1 parent 398dbd5 commit 78c251478437a91a4ae43475856e2e77e44c4bf2
Showing with 9 additions and 32 deletions.
  1. +1 −1 opy/_regtest/dis-md5.golden.txt
  2. +6 −12 opy/compiler2/pycodegen.py
  3. +2 −19 opy/opy_main.py
@@ -202,7 +202,7 @@
28978 581863c0d28c4f23d0eaaaab3a525f33 _tmp/regtest/test/sh_spec.pyc
29159 58e8951b48374c0368253e32c9550075 _tmp/regtest/_abcoll.pyc
29440 5ae214959a39478444778fa9800f4dd6 _tmp/regtest/collections.pyc
30204 7b90326a7eab1a0f0d42f21382c966e3 _tmp/regtest/opy/compiler2/pyassem.pyc
30189 f35996cd972c094ecaad6088af2c72b6 _tmp/regtest/opy/compiler2/pyassem.pyc
30811 02d4a38a06b87bc1875e62ffe18bb88a _tmp/regtest/core/builtin.pyc
32295 29b6c155971a78b46cae1c83500f7efb _tmp/regtest/osh/word_parse.pyc
32295 3f24a5980d6761b920977cfa7856a65d _tmp/regtest/opy/pytree.pyc
View
@@ -178,19 +178,15 @@ def _nameOp(self, prefix, name):
scope = self.scope.check_name(name)
if scope == SC_LOCAL:
if self._optimized():
self.emit(prefix + '_FAST', name)
else:
self.emit(prefix + '_NAME', name)
suffix = 'FAST' if self._optimized() else 'NAME'
self.emit('%s_%s' % (prefix, suffix), name)
elif scope == SC_GLOBAL_EXPLICIT:
self.emit(prefix + '_GLOBAL', name)
elif scope == SC_GLOBAL_IMPLICIT:
if self._optimized():
self.emit(prefix + '_GLOBAL', name)
else:
self.emit(prefix + '_NAME', name)
suffix = 'GLOBAL' if self._optimized() else 'NAME'
self.emit('%s_%s' % (prefix, suffix), name)
elif scope == SC_FREE or scope == SC_CELL:
self.emit(prefix + '_DEREF', name)
@@ -206,10 +202,8 @@ def _implicitNameOp(self, prefix, name):
dollar sign. The symbol table ignores these names because
they aren't present in the program text.
"""
if self._optimized():
self.emit(prefix + '_FAST', name)
else:
self.emit(prefix + '_NAME', name)
suffix = 'FAST' if self._optimized() else 'NAME'
self.emit('%s_%s' % (prefix, suffix), name)
# The set_lineno() function and the explicit emit() calls for
# SET_LINENO below are only used to generate the line number table.
View
@@ -10,13 +10,6 @@
import os
import sys
import marshal
#import logging
# Like oil.py, set PYTHONPATH internally? So symlinks work?
# Actually '.' is implicitly in PYTHONPATH, so we don't need it.
# If we were in bin/oil.py, then we would need this.
#this_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
#sys.path.append(os.path.join(this_dir))
from . import pytree
from . import skeleton
@@ -52,7 +45,6 @@ def __init__(self, gr):
#log('%s -> %d' % (name, symbol))
# For transformer to use
self.number2symbol = gr.number2symbol
#assert 0
def HostStdlibNames():
@@ -185,10 +177,10 @@ def OpyCommandMain(argv):
tree = st.totuple()
n = CountTupleTree(tree)
log('COUNT %d', n)
printer = TupleTreePrinter(HostStdlibNames())
printer.Print(tree)
n = CountTupleTree(tree)
log('COUNT %d', n)
elif action == 'lex':
py_path = argv[1]
@@ -318,12 +310,3 @@ def OpyCommandMain(argv):
else:
raise args.UsageError('Invalid action %r' % action)
# Examples of nodes Leaf(type, value):
# Leaf(1, 'def')
# Leaf(4, '\n')
# Leaf(8, ')')
# Oh are these just tokens?
# yes.
# Node(prefix, children)

0 comments on commit 78c2514

Please sign in to comment.