Commits

Armin Rigo committed d99f354

(iko, arigo)
Kill kill kill unused code.

Comments (0)

Files changed (2)

pypy/interpreter/astcompiler/__init__.py

-"""Package for parsing and compiling Python source code
-
-There are several functions defined at the top level that are imported
-from modules contained in the package.
-
-parse(buf, mode="exec") -> AST
-    Converts a string containing Python source code to an abstract
-    syntax tree (AST).  The AST is defined in compiler.ast.
-
-parseFile(path) -> AST
-    The same as parse(open(path))
-
-walk(ast, visitor, verbose=None)
-    Does a pre-order walk over the ast using the visitor instance.
-    See compiler.visitor for details.
-
-compile(source, filename, mode, flags=None, dont_inherit=None)
-    Returns a code object.  A replacement for the builtin compile() function.
-
-compileFile(filename)
-    Generates a .pyc file by compiling filename.
-"""
-
-# from transformer import parse, parseFile
-# from visitor import walk
-# from pycodegen import compile, compileFile
+# empty

pypy/interpreter/astcompiler/pycodegen.py

 
 from pypy.module.__builtin__.__init__ import BUILTIN_TO_INDEX
 
-def compileFile(filename, display=0):
-    f = open(filename, 'U')
-    buf = f.read()
-    f.close()
-    mod = Module(buf, filename)
-    try:
-        mod.compile(display)
-    except SyntaxError:
-        raise
-    else:
-        f = open(filename + "c", "wb")
-        mod.dump(f)
-        f.close()
-
 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:
             print pprint.pprint(tree)
         self.code = gen.getCode()
 
-    def dump(self, f):
-        f.write(self.getPycHeader())
-        marshal.dump(self.code, f)
-
-    MAGIC = imp.get_magic()
-
-    def getPycHeader(self):
-        # compile.c uses marshal to write a long directly, with
-        # calling the interface that would also generate a 1-byte code
-        # to indicate the type of the value.  simplest way to get the
-        # same effect is to call marshal and then skip the code.
-        mtime = os.path.getmtime(self.filename)
-        mtime = struct.pack('<i', mtime)
-        return self.MAGIC + mtime
-
 class CodeGenerator(ast.ASTVisitor):
     """Defines basic code generator for Python bytecode
     """
     def visitSubscript(self, node):
         self.main.emit('ROT_THREE')
         self.main.emit('STORE_SUBSCR')
-
-if __name__ == "__main__":
-    for file in sys.argv[1:]:
-        compileFile(file)