def task_source_js(self): from pypy.translator.js.js import JS self.gen = JS(self.translator, functions=[self.entry_point], stackless=self.config.translation.stackless) filename = self.gen.write_source() self.log.info("Wrote %s" % (filename, ))
def __init__(self, function, annotations, stackless=False, view=False, html=None, is_interactive=False, root=None, run_browser=True, policy=None): if not use_browsertest and not _CLI_is_on_path(): py.test.skip('Javascript CLI (js) not found') self.html = html self.is_interactive = is_interactive t = TranslationContext() if policy is None: from pypy.annotation.policy import AnnotatorPolicy policy = AnnotatorPolicy() policy.allow_someobjects = False ann = t.buildannotator(policy=policy) ann.build_types(function, annotations) if view or option.view: t.view() t.buildrtyper(type_system="ootype").specialize() if view or option.view: t.view() #self.js = JS(t, [function, callback_function], stackless) self.js = JS(t, function, stackless) self.js.write_source() if root is None and use_tg: from pypy.translator.js.demo.jsdemo.controllers import Root self.root = Root else: self.root = root self.run_browser = run_browser self.function_calls = []