def testScanAssembly(self): from nine.scope import Scope from ast.namespace import Namespace scope = Scope(parent=None) globalNs = Namespace('') driver = Driver() driver.addReference('bin/ClassLibrary1') driver._scanAssembly(globalNs, 'bin/ClassLibrary1') cls = globalNs.symbols['TestClass'].symbols['TestClass'] assert isinstance(cls, ExternalClass) assert cls.external self.assertEqual(cls.name, 'TestClass')
def buildProgram(name, program, assemblies=[]): exeName = name path, name = os.path.split(exeName) name, ext = os.path.splitext(name) path = path or 'bin' ext = ext or '.exe' exeName = os.path.join(path, name + ext) if os.access(exeName, os.F_OK): # Delete any pre-existing file os.unlink(exeName) driver = Driver() for asm in assemblies: driver.addReference(asm) driver.compileString(program, exeName) assert os.access(exeName, os.F_OK)
try: options, args = getopt.gnu_getopt(sys.argv[1:], 'r:o:') except getopt.GetoptError, e: print e syntax() from nine.driver import Driver sources = args outputName = '9out' references = [] the_driver = Driver() for option, operand in options: if option == '-r': the_driver.addReference(operand) if option == '-o': outputName = operand if 0: try: the_driver.compile(sources, outputName) except error.CodeError, e: print e sys.exit(1) else: the_driver.compile(sources, outputName)