{"action":"created","comment":{"url":"https://api.github.com/repos/pypyjs/pypyjs/pulls/comments/45963578","id":45963578,"diff_hunk":"@@ -0,0 +1,1019 @@\n+\n+//  pypyjs:  an experimental in-browser python environment.\n+//\n+\n+// Expose the main pypyjs function at global scope for this file,\n+// as well as in any module exports or 'window' object we can find.\n+\n+let _dirname;\n+\n+// Find the directory containing this very file.\n+// It can be quite difficult depending on execution environment...\n+if (typeof __dirname === 'undefined') {\n+  _dirname = './';\n+\n+  // A little hackery to find the URL of this very file.\n+  // Throw an error, then parse the stack trace looking for filenames.\n+  const errlines = (new Error()).stack.split('\\n');\n+  errlines.forEach((line) => {\n+    const match = /(at Anonymous function \\(|at |@)(.+\\/)pypyjs.js/.exec(line);\n+    if (match) {\n+      _dirname = match[2];\n+    }\n+  });\n+} else {\n+  _dirname = __dirname;\n+}\n+\n+if (_dirname.charAt(_dirname.length - 1) !== '/') {\n+  _dirname += '/';\n+}\n+\n+let Promise;\n+let FunctionPromise;\n+\n+// Ensure we have reference to a 'Promise' constructor.\n+if (typeof Promise === 'undefined') {\n+  if (this && typeof this.Promise !== 'undefined') {\n+    Promise = this.Promise;\n+  } else if (typeof require === 'function') {\n+    Promise = require('./Promise.min.js');\n+  } else if (typeof load === 'function') {\n+    load(_dirname + 'Promise.min.js');\n+    if (typeof Promise === 'undefined') {\n+      if (this && typeof this.Promise !== 'undefined') {\n+        Promise = this.Promise;\n+      }\n+    }\n+  } else if (typeof window !== 'undefined') {\n+    if (typeof window.Promise !== 'undefined') {\n+      Promise = window.Promise;\n+    }\n+  }\n+}\n+\n+if (typeof Promise === 'undefined') {\n+  throw new Error('Promise object not found');\n+}\n+\n+// Ensure we have reference to a 'FunctionPromise' constructor.\n+if (typeof FunctionPromise === 'undefined') {\n+  if (this && typeof this.FunctionPromise !== 'undefined') {\n+    FunctionPromise = this.FunctionPromise;\n+  } else if (typeof require === 'function') {\n+    FunctionPromise = require('./FunctionPromise.js');\n+  } else if (typeof load === 'function') {\n+    load(_dirname + 'FunctionPromise.js');\n+    if (typeof FunctionPromise === 'undefined') {\n+      if (this && typeof this.FunctionPromise !== 'undefined') {\n+        FunctionPromise = this.FunctionPromise;\n+      }\n+    }\n+  } else if (typeof window !== 'undefined') {\n+    if (typeof window.FunctionPromise !== 'undefined') {\n+      FunctionPromise = window.FunctionPromise;\n+    }\n+  }\n+}\n+\n+if (typeof FunctionPromise === 'undefined') {\n+  throw new Error('FunctionPromise object not found');\n+}\n+\n+let fs;\n+let path;\n+// Some extra goodies for nodejs.\n+if (typeof process !== 'undefined') {\n+  if (Object.prototype.toString.call(process) === '[object process]') {\n+    fs = require('fs');\n+    path = require('path');\n+  }\n+}\n+\n+// Create functions for handling default stdio streams.\n+// These will be shared by all VM instances by default.\n+//\n+// We default stdout and stderr to process outputs if available,\n+// printing/logging functions otherwise, and /dev/null if nothing\n+// else is available.  Unfortunately there's no good way to read\n+// synchronously from stdin in javascript, so that's always /dev/null.\n+\n+const devNull = {\n+  stdin: function stdin() {\n+    return null;\n+  },\n+  stdout: function stdout() { },\n+  stderr: function stderr() { }\n+};\n+\n+const stdio = {\n+  stdin: null,\n+  stdout: null,\n+  stderr: null\n+};\n+\n+stdio.stdin = devNull.stdin;\n+\n+if (typeof process !== 'undefined') {\n+  if (typeof process.stdout !== 'undefined') {\n+    stdio.stdout = function stdout(byte) { process.stdout.write(byte); };\n+  }\n+\n+  if (typeof process.stderr !== 'undefined') {\n+    stdio.stderr = function stderr(byte) { process.stderr.write(byte); };\n+  }\n+}\n+\n+let _print;\n+let _printErr;\n+if (typeof window === 'undefined') {\n+  // print, printErr from v8, spidermonkey\n+  if (typeof print !== 'undefined') {\n+    _print = print;\n+  }\n+\n+  if (typeof printErr !== 'undefined') {\n+    _printErr = printErr;\n+  }\n+}\n+\n+if (typeof console !== 'undefined') {\n+  if (typeof _print === 'undefined') {\n+    _print = console.log.bind(console);\n+  }\n+\n+  if (typeof _printErr === 'undefined') {\n+    _printErr = console.error.bind(console);\n+  }\n+}\n+\n+if (stdio.stdout === null && typeof _print !== 'undefined') {\n+  // print()/console.log() will add a newline, so we buffer until we\n+  // receive one and then let it add it for us.\n+  const buffer = [];\n+  stdio.stdout = function stdout(data) {\n+    for (let i = 0; i < data.length; i++) {\n+      const byte = data.charAt(i);\n+      if (byte !== '\\n') {\n+        buffer.push(byte);\n+      } else {\n+        _print(buffer.join(''));\n+        buffer.splice(undefined, buffer.length);\n+      }\n+    }\n+  };\n+}\n+\n+if (stdio.stderr === null && typeof _printErr !== 'undefined') {\n+  // printErr()/console.error() will add a newline, so we buffer until we\n+  // receive one and then let it add it for us.\n+  const buffer = [];\n+  stdio.stderr = function stderr(data) {\n+    for (let i = 0; i < data.length; i++) {\n+      const byte = data.charAt(i);\n+      if (byte !== '\\n') {\n+        buffer.push(byte);\n+      } else {\n+        _printErr(buffer.join(''));\n+        buffer.splice(undefined, buffer.length);\n+      }\n+    }\n+  };\n+}\n+\n+if (stdio.stdout === null) {\n+  stdio.stdout = devNull.stdout;\n+}\n+\n+if (stdio.stderr === null) {\n+  stdio.stderr = devNull.stderr;\n+}\n+\n+// Main class representing the PyPy VM.\n+// This is our primary export and return value.\n+\n+function pypyjs(opts) {\n+  const _opts = opts || {};\n+  this.rootURL = _opts.rootURL;\n+  this.totalMemory = _opts.totalMemory || 128 * 1024 * 1024;\n+  this.autoLoadModules = _opts.autoLoadModules || true;\n+  this._pendingModules = {};\n+  this._loadedModules = {};\n+  this._allModules = {};\n+\n+  // Allow opts to override default IO streams.\n+  this.stdin = _opts.stdin || stdio.stdin;\n+  this.stdout = _opts.stdout || stdio.stdout;\n+  this.stderr = _opts.stderr || stdio.stderr;\n+\n+  // Default to finding files relative to this very file.\n+  if (!this.rootURL && !pypyjs.rootURL) {\n+    pypyjs.rootURL = _dirname;\n+  }\n+\n+  if (this.rootURL && this.rootURL.charAt(this.rootURL.length - 1) !== '/') {\n+    this.rootURL += '/';\n+  }\n+\n+  // If we haven't already done so, fetch and load the code for the VM.\n+  // We do this once and cache the result for re-use, so that we don't\n+  // have to pay asmjs compilation overhead each time we create the VM.\n+\n+  if (!pypyjs._vmBuilderPromise) {\n+    pypyjs._vmBuilderPromise = this.fetch('pypyjs.vm.js').then((xhr) => {\n+      // Parse the compiled code, hopefully asynchronously.\n+      // Unfortunately our use of Function constructor here doesn't\n+      // play very well with nodejs, where things like 'module' and\n+      // 'require' are not in the global scope.  We have to pass them\n+      // in explicitly as arguments.\n+      const funcBody = [\n+\n+        // This is the compiled code for the VM.\n+        xhr.responseText,\n+        '\\n',\n+\n+        // Ensure that some functions are available on the Module,\n+        // for linking with jitted code.\n+        'if (!Module._jitInvoke && typeof _jitInvoke !== \\'undefined\\') {',\n+        '  Module._jitInvoke = _jitInvoke;',\n+        '}',\n+\n+        // Keep some functions that are not exported by default, but\n+        // which appear in this scope when evaluating the above.\n+        'Module._emjs_make_handle = _emjs_make_handle;',\n+        'Module._emjs_free = _emjs_free;',\n+\n+        // Call dependenciesFulfilled if it won't be done automatically.\n+        'dependenciesFulfilled=function() { inDependenciesFulfilled(FS); };',\n+        'if(!memoryInitializer||(!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER))dependenciesFulfilled();',\n+      ].join('\\r\\n');\n+      return new FunctionPromise('Module', 'inDependenciesFulfilled', 'require',\n+                             'module', '__filename', '_dirname', funcBody);\n+    });\n+  }\n+\n+  // Create a new instance of the compiled VM, bound to local state\n+  // and a local Module object.\n+  this._ready = new Promise((resolve, reject) => {\n+    // Initialize the Module object.\n+    // We make it available on this object so that we can use\n+    // its methods to execute code in the VM.\n+    const Module = {};\n+    this._module = Module;\n+    Module.TOTAL_MEMORY = this.totalMemory;\n+\n+    // We will set up the filesystem manually when we're ready.\n+    Module.noFSInit = true;\n+    Module.thisProgram = '/lib/pypyjs/pypyjs.js';\n+    Module.filePackagePrefixURL = this.rootURL || pypyjs.rootURL;\n+    Module.memoryInitializerPrefixURL = this.rootURL || pypyjs.rootURL;\n+    Module.locateFile = function locateFile(name) {\n+      return (this.rootURL || pypyjs.rootURL) + name;\n+    };\n+\n+    // Don't start or stop the program, just set it up.\n+    // We'll call the API functions ourself.\n+    Module.noInitialRun = true;\n+    Module.noExitRuntime = true;\n+\n+    let stdoutBuffer = [];\n+    // Route stdin to an overridable method on the object.\n+    const stdin = () => {\n+      if (stdoutBuffer.length) {\n+        this.stdout(stdoutBuffer.join(''));\n+        stdoutBuffer = [];\n+      }\n+      return this.stdin();\n+    };\n+\n+    // Route stdout to an overridable method on the object.\n+    // We buffer the output for efficiency.\n+    const stdout = (byte) => {\n+      const char = String.fromCharCode(byte);\n+      stdoutBuffer.push(char);\n+      if (char === '\\n' || stdoutBuffer.length >= 128) {\n+        this.stdout(stdoutBuffer.join(''));\n+        stdoutBuffer = [];\n+      }\n+    };\n+\n+    // Route stderr to an overridable method on the object.\n+    // We do not buffer stderr.\n+    const stderr = (byte) => this.stderr(String.fromCharCode(byte));\n+\n+    // This is where execution will continue after loading\n+    // the memory initialization data, if any.\n+    let initializedResolve;\n+    let initializedReject;\n+    const initializedP = new Promise(function promise(_resolve, _reject) {\n+      initializedResolve = _resolve;\n+      initializedReject = _reject;\n+    });\n+\n+    const dependenciesFulfilled = (_fs) => {\n+      this.FS = _fs;\n+\n+      // Initialize the filesystem state.\n+      try {\n+        this.FS.init(stdin, stdout, stderr);\n+        Module.FS_createPath('/', 'lib/pypyjs/lib_pypy', true, false);\n+        // Hackery so the same file will work with py2 and py3.\n+        // We only ever put our module files into lib_pypy.\n+        Module.FS_createPath('/', 'lib/pypyjs/lib-python/2.7', true, false);\n+        Module.FS_createPath('/', 'lib/pypyjs/lib-python/3', true, false);\n+        initializedResolve();\n+      } catch (err) {\n+        initializedReject(err);\n+      }\n+    };\n+\n+    // Begin fetching the metadata for available python modules.\n+    // With luck these can download while we jank around compiling\n+    // all of that javascript.\n+    // XXX TODO: also load memory initializer this way.\n+    const moduleDataP = this.fetch('modules/index.json');\n+\n+    pypyjs._vmBuilderPromise.then((vmBuilder) => {\n+      const args = [\n+        Module,\n+        dependenciesFulfilled,\n+        typeof require === 'undefined' ? undefined : require,\n+        typeof module === 'undefined' ? undefined : module,\n+        typeof __filename === 'undefined' ? undefined : __filename,\n+        typeof _dirname === 'undefined' ? undefined : _dirname\n+      ];\n+\n+      // This links the async-compiled module into our Module object.\n+      vmBuilder.apply(null, args);\n+      return initializedP;\n+    }).then(() => {\n+      // Continue with processing the downloaded module metadata.\n+      return moduleDataP.then((xhr) => {\n+        // Store the module index, and load any preload modules.\n+        const modIndex = JSON.parse(xhr.responseText);\n+        this._allModules = modIndex.modules;\n+        if (modIndex.preload) {\n+          Object.keys(modIndex.preload).forEach((name) => {\n+            this._writeModuleFile(name, modIndex.preload[name]);\n+          });\n+        }\n+\n+        // It's finally safe to launch the VM.\n+        Module.run();\n+        Module._rpython_startup_code();\n+        let pypy_home = Module.intArrayFromString('/lib/pypyjs/pypyjs.js');\n+        pypy_home = Module.allocate(pypy_home, 'i8', Module.ALLOC_NORMAL);\n+        Module._pypy_setup_home(pypy_home, 0);\n+        Module._free(pypy_home);\n+        const initCode = `\n+import js\n+import traceback\n+import sys; sys.platform = 'js'\n+# For python3, pypy does some lazy-initialization stuff\n+# with stdio streams that isn't triggered when you use\n+# it as a library instead of an exe.  Fix it up.\n+def create_stdio(fd, mode, name, errors=None):\n+  import io\n+  return io.open(fd, mode, buffering=1, errors=errors, closefd=False)\n+if not hasattr(sys, 'stdin'):\n+  sys.stdin = sys.__stdin__ = create_stdio(0, 'r', '<stdin>')\n+  sys.stdout = sys.__stdout__ = create_stdio(1, 'w', '<stdout>')\n+  sys.stderr = sys.__stderr = create_stdio(2, 'w', '<stderr>', 'backslashreplace')\n+# Create a \"__main__\" module in which we'll execute code.\n+import types\n+top_level_scope = {'__name__': '__main__', '__package__': None}\n+main = types.ModuleType('__main__')\n+main.__dict__.update(top_level_scope)\n+sys.modules['__main__'] = main\n+top_level_scope = main`;\n+\n+        let code = Module.intArrayFromString(initCode);\n+        code = Module.allocate(code, 'i8', Module.ALLOC_NORMAL);\n+        if (!code) {\n+          throw new pypyjs.Error('Failed to allocate memory');\n+        }\n+\n+        const res = Module._pypy_execute_source(code);\n+        if (res < 0) {\n+          throw new pypyjs.Error('Failed to execute python code');\n+        }\n+\n+        Module._free(code);\n+      });\n+    })\n+    .then(resolve, reject);\n+  });\n+}\n+\n+// A simple file-fetching wrapper around XMLHttpRequest,\n+// that treats paths as relative to the pypyjs.js root url.\n+//\n+pypyjs.prototype.fetch = function fetch(relpath, responseType) {\n+  const rootURL = this.rootURL || pypyjs.rootURL;\n+\n+  // For the web, use XMLHttpRequest.\n+  if (typeof XMLHttpRequest !== 'undefined') {\n+    return new Promise((resolve, reject) => {\n+      const xhr = new XMLHttpRequest();\n+      xhr.onload = function onload() {\n+        if (xhr.status >= 400) {\n+          reject(xhr);\n+        } else {\n+          resolve(xhr);\n+        }\n+      };\n+\n+      xhr.open('GET', rootURL + relpath, true);\n+      xhr.responseType = responseType || 'text';\n+      xhr.send(null);\n+    });\n+  }\n+\n+  // For nodejs, use fs.readFile.\n+  if (typeof fs !== 'undefined' && typeof fs.readFile !== 'undefined') {\n+    return new Promise((resolve, reject) => {\n+      fs.readFile(path.join(rootURL, relpath), (err, data) => {\n+        if (err) return reject(err);\n+        resolve({ responseText: data.toString() });\n+      });\n+    });\n+  }\n+\n+  // For spidermonkey, use snarf (which has a binary read mode).\n+  if (typeof snarf !== 'undefined') {\n+    return new Promise((resolve) => {\n+      const data = snarf(rootURL + relpath);\n+      resolve({ responseText: data });\n+    });\n+  }\n+\n+  // For d8, use read() and readbuffer().\n+  if (typeof read !== 'undefined' && typeof readbuffer !== 'undefined') {\n+    return new Promise((resolve) => {\n+      const data = read(rootURL + relpath);\n+      resolve({ responseText: data });\n+    });\n+  }\n+\n+  return new Promise((resolve, reject) => {\n+    reject('unable to fetch files');\n+  });\n+};\n+\n+function _escape(value) {\n+  return value.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, '\\\\\\'');\n+}\n+\n+// Method to execute python source directly in the VM.\n+//\n+// This is the basic way to push code into the pypyjs VM.\n+// Calling code should not use it directly; rather we use it\n+// as a primitive to build up a nicer execution API.\n+//\n+pypyjs.prototype._execute_source = function _execute_source(code) {\n+  const Module = this._module;\n+  let code_ptr;\n+\n+  return new Promise(function promise(resolve, reject) {\n+    const _code = `try:\n+  ${code.trim()}\n+except Exception:\n+  typ, val, tb = sys.exc_info()\n+  err_name = getattr(typ, '__name__', str(typ))\n+  err_msg = str(val)\n+  err_trace = traceback.format_exception(typ, val, tb)\n+  err_trace = err_trace[:1] + err_trace[2:]\n+  err_trace = ''.join(err_trace)\n+  js.globals['pypyjs']._lastErrorName = err_name\n+  js.globals['pypyjs']._lastErrorMessage = err_msg\n+  js.globals['pypyjs']._lastErrorTrace = err_trace\n+`;\n+\n+    const code_chars = Module.intArrayFromString(_code);\n+    code_ptr = Module.allocate(code_chars, 'i8', Module.ALLOC_NORMAL);\n+    if (!code_ptr) {\n+      throw new pypyjs.Error('Failed to allocate memory');\n+    }\n+\n+    const res = Module._pypy_execute_source(code_ptr);\n+    if (res < 0) {\n+      throw new pypyjs.Error('Error executing python code');\n+    }\n+\n+    Module._free(code_ptr);\n+\n+    // XXX TODO: races/re-entrancy on _lastError?\n+    if (pypyjs._lastErrorName) {\n+      const err = new pypyjs.Error(\n+        pypyjs._lastErrorName,\n+        pypyjs._lastErrorMessage,\n+        pypyjs._lastErrorTrace\n+      );\n+      pypyjs._lastErrorName = null;\n+      pypyjs._lastErrorMessage = null;\n+      pypyjs._lastErrorTrace = null;\n+      reject(err);\n+    }\n+\n+    resolve(null);\n+  });\n+};\n+\n+// Method to determine when the interpreter is ready.\n+//\n+// This method returns a promise that will resolve once the interpreter\n+// is ready for use.\n+//\n+pypyjs.prototype.ready = function ready() {\n+  return this._ready;\n+};\n+\n+// Method to execute some python code.\n+//\n+// This passes the given python code to the VM for execution.\n+// It's fairly directly analogous to the 'exec\" statement in python.\n+// It is not possible to directly access the result of the code, if any.\n+// Rather you should store it into a variable and then use the get() method.\n+//\n+pypyjs.prototype.exec = function exec(code, options) {\n+  return this._ready.then(() => {\n+    let promise = Promise.resolve();\n+\n+    // Find any \"import\" statements in the code,\n+    // and ensure the modules are ready for loading.\n+    if (this.autoLoadModules) {\n+      promise = promise.then(() => {\n+        return this.findImportedNames(code);\n+      })\n+      .then((imports) => {\n+        return this.loadModuleData.apply(this, imports);\n+      });\n+    }\n+\n+    let _code;\n+\n+    if (options && options.file) {\n+      try {\n+        this.Module.FS.unlink(options.file);\n+      } catch (e) {\n+        if (e.errno !== 2) {\n+          console.error(e);\n+        }\n+      }\n+      this.Module.FS_createDataFile(options.file, '', code, true, false, true);\n+      // Now we can execute the code in custom top-level scope.\n+      _code = `top_level_scope['__file__'] = '${options.file}'; execfile('${options.file}', top_level_scope.__dict__)`;\n+    } else {\n+      _code = `exec('''${_escape(code)}''' in top_level_scope.__dict__)`;","path":"src/pypyjs.js","position":567,"original_position":567,"commit_id":"48672e6f5d26226ace3ed9359dbf5db588484729","original_commit_id":"48672e6f5d26226ace3ed9359dbf5db588484729","user":{"login":"rfk","id":34695,"avatar_url":"https://avatars.githubusercontent.com/u/34695?v=3","gravatar_id":"","url":"https://api.github.com/users/rfk","html_url":"https://github.com/rfk","followers_url":"https://api.github.com/users/rfk/followers","following_url":"https://api.github.com/users/rfk/following{/other_user}","gists_url":"https://api.github.com/users/rfk/gists{/gist_id}","starred_url":"https://api.github.com/users/rfk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfk/subscriptions","organizations_url":"https://api.github.com/users/rfk/orgs","repos_url":"https://api.github.com/users/rfk/repos","events_url":"https://api.github.com/users/rfk/events{/privacy}","received_events_url":"https://api.github.com/users/rfk/received_events","type":"User","site_admin":false},"body":"This needs to become `exec(code, dict)` not `exec(code in dict)` type throws a `TypeError`.  I have it fixed in my local copy, if that's all it takes to get the tests running then I'll just merge with the fix.","created_at":"2015-11-26T10:28:46Z","updated_at":"2015-11-26T10:28:46Z","html_url":"https://github.com/pypyjs/pypyjs/pull/170#discussion_r45963578","pull_request_url":"https://api.github.com/repos/pypyjs/pypyjs/pulls/170","_links":{"self":{"href":"https://api.github.com/repos/pypyjs/pypyjs/pulls/comments/45963578"},"html":{"href":"https://github.com/pypyjs/pypyjs/pull/170#discussion_r45963578"},"pull_request":{"href":"https://api.github.com/repos/pypyjs/pypyjs/pulls/170"}}},"pull_request":{"url":"https://api.github.com/repos/pypyjs/pypyjs/pulls/170","id":46711088,"html_url":"https://github.com/pypyjs/pypyjs/pull/170","diff_url":"https://github.com/pypyjs/pypyjs/pull/170.diff","patch_url":"https://github.com/pypyjs/pypyjs/pull/170.patch","issue_url":"https://api.github.com/repos/pypyjs/pypyjs/issues/170","number":170,"state":"open","locked":false,"title":"Move to es6","user":{"login":"albertjan","id":301791,"avatar_url":"https://avatars.githubusercontent.com/u/301791?v=3","gravatar_id":"","url":"https://api.github.com/users/albertjan","html_url":"https://github.com/albertjan","followers_url":"https://api.github.com/users/albertjan/followers","following_url":"https://api.github.com/users/albertjan/following{/other_user}","gists_url":"https://api.github.com/users/albertjan/gists{/gist_id}","starred_url":"https://api.github.com/users/albertjan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albertjan/subscriptions","organizations_url":"https://api.github.com/users/albertjan/orgs","repos_url":"https://api.github.com/users/albertjan/repos","events_url":"https://api.github.com/users/albertjan/events{/privacy}","received_events_url":"https://api.github.com/users/albertjan/received_events","type":"User","site_admin":false},"body":"I understand this is a very big PR and will make merging with other PR difficult. I don't mind if those get merged first and that I have to rebase this. \r\n\r\nFirst and foremost this is a translation to es6, all the `.bind(this)`'s in the code made me so confused :smile:. es introduces the fat arrow method `=>` that will keep the same scope as the function it's in. It also introduces string literals. :tada:! Something very similar to the `'''` strings in python.\r\n\r\nYou have to transpile the src/pypyjs.js to lib/pypyjs.js by running the gulp script in the root. You'll need to run `npm install` in the root and `npm install gulp -g`. \r\n\r\nGulp also lints the code using eslint. the configuration for that is in `.eslintrc`\r\n\r\nThis also fixes a bug in the repl because it didn't use the new `top_level_scope`.\r\n","created_at":"2015-10-03T19:02:32Z","updated_at":"2015-11-26T10:28:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3b417e49ba0d4304fb16c0dfe0738914ddb7edae","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pypyjs/pypyjs/pulls/170/commits","review_comments_url":"https://api.github.com/repos/pypyjs/pypyjs/pulls/170/comments","review_comment_url":"https://api.github.com/repos/pypyjs/pypyjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pypyjs/pypyjs/issues/170/comments","statuses_url":"https://api.github.com/repos/pypyjs/pypyjs/statuses/48672e6f5d26226ace3ed9359dbf5db588484729","head":{"label":"trinketapp:es6-upstream","ref":"es6-upstream","sha":"48672e6f5d26226ace3ed9359dbf5db588484729","user":{"login":"trinketapp","id":6341521,"avatar_url":"https://avatars.githubusercontent.com/u/6341521?v=3","gravatar_id":"","url":"https://api.github.com/users/trinketapp","html_url":"https://github.com/trinketapp","followers_url":"https://api.github.com/users/trinketapp/followers","following_url":"https://api.github.com/users/trinketapp/following{/other_user}","gists_url":"https://api.github.com/users/trinketapp/gists{/gist_id}","starred_url":"https://api.github.com/users/trinketapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trinketapp/subscriptions","organizations_url":"https://api.github.com/users/trinketapp/orgs","repos_url":"https://api.github.com/users/trinketapp/repos","events_url":"https://api.github.com/users/trinketapp/events{/privacy}","received_events_url":"https://api.github.com/users/trinketapp/received_events","type":"Organization","site_admin":false},"repo":{"id":35495131,"name":"pypyjs","full_name":"trinketapp/pypyjs","owner":{"login":"trinketapp","id":6341521,"avatar_url":"https://avatars.githubusercontent.com/u/6341521?v=3","gravatar_id":"","url":"https://api.github.com/users/trinketapp","html_url":"https://github.com/trinketapp","followers_url":"https://api.github.com/users/trinketapp/followers","following_url":"https://api.github.com/users/trinketapp/following{/other_user}","gists_url":"https://api.github.com/users/trinketapp/gists{/gist_id}","starred_url":"https://api.github.com/users/trinketapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trinketapp/subscriptions","organizations_url":"https://api.github.com/users/trinketapp/orgs","repos_url":"https://api.github.com/users/trinketapp/repos","events_url":"https://api.github.com/users/trinketapp/events{/privacy}","received_events_url":"https://api.github.com/users/trinketapp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/trinketapp/pypyjs","description":"PyPy compiled to JavaScript","fork":true,"url":"https://api.github.com/repos/trinketapp/pypyjs","forks_url":"https://api.github.com/repos/trinketapp/pypyjs/forks","keys_url":"https://api.github.com/repos/trinketapp/pypyjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/trinketapp/pypyjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/trinketapp/pypyjs/teams","hooks_url":"https://api.github.com/repos/trinketapp/pypyjs/hooks","issue_events_url":"https://api.github.com/repos/trinketapp/pypyjs/issues/events{/number}","events_url":"https://api.github.com/repos/trinketapp/pypyjs/events","assignees_url":"https://api.github.com/repos/trinketapp/pypyjs/assignees{/user}","branches_url":"https://api.github.com/repos/trinketapp/pypyjs/branches{/branch}","tags_url":"https://api.github.com/repos/trinketapp/pypyjs/tags","blobs_url":"https://api.github.com/repos/trinketapp/pypyjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/trinketapp/pypyjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/trinketapp/pypyjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/trinketapp/pypyjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/trinketapp/pypyjs/statuses/{sha}","languages_url":"https://api.github.com/repos/trinketapp/pypyjs/languages","stargazers_url":"https://api.github.com/repos/trinketapp/pypyjs/stargazers","contributors_url":"https://api.github.com/repos/trinketapp/pypyjs/contributors","subscribers_url":"https://api.github.com/repos/trinketapp/pypyjs/subscribers","subscription_url":"https://api.github.com/repos/trinketapp/pypyjs/subscription","commits_url":"https://api.github.com/repos/trinketapp/pypyjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/trinketapp/pypyjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/trinketapp/pypyjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/trinketapp/pypyjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/trinketapp/pypyjs/contents/{+path}","compare_url":"https://api.github.com/repos/trinketapp/pypyjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/trinketapp/pypyjs/merges","archive_url":"https://api.github.com/repos/trinketapp/pypyjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/trinketapp/pypyjs/downloads","issues_url":"https://api.github.com/repos/trinketapp/pypyjs/issues{/number}","pulls_url":"https://api.github.com/repos/trinketapp/pypyjs/pulls{/number}","milestones_url":"https://api.github.com/repos/trinketapp/pypyjs/milestones{/number}","notifications_url":"https://api.github.com/repos/trinketapp/pypyjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/trinketapp/pypyjs/labels{/name}","releases_url":"https://api.github.com/repos/trinketapp/pypyjs/releases{/id}","created_at":"2015-05-12T15:04:59Z","updated_at":"2015-06-19T17:23:14Z","pushed_at":"2015-11-26T09:05:47Z","git_url":"git://github.com/trinketapp/pypyjs.git","ssh_url":"git@github.com:trinketapp/pypyjs.git","clone_url":"https://github.com/trinketapp/pypyjs.git","svn_url":"https://github.com/trinketapp/pypyjs","homepage":null,"size":179839,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"pypyjs:master","ref":"master","sha":"7334a522a62ccd8cdf4e7afbc5fe137c7afed556","user":{"login":"pypyjs","id":12670864,"avatar_url":"https://avatars.githubusercontent.com/u/12670864?v=3","gravatar_id":"","url":"https://api.github.com/users/pypyjs","html_url":"https://github.com/pypyjs","followers_url":"https://api.github.com/users/pypyjs/followers","following_url":"https://api.github.com/users/pypyjs/following{/other_user}","gists_url":"https://api.github.com/users/pypyjs/gists{/gist_id}","starred_url":"https://api.github.com/users/pypyjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pypyjs/subscriptions","organizations_url":"https://api.github.com/users/pypyjs/orgs","repos_url":"https://api.github.com/users/pypyjs/repos","events_url":"https://api.github.com/users/pypyjs/events{/privacy}","received_events_url":"https://api.github.com/users/pypyjs/received_events","type":"Organization","site_admin":false},"repo":{"id":15023050,"name":"pypyjs","full_name":"pypyjs/pypyjs","owner":{"login":"pypyjs","id":12670864,"avatar_url":"https://avatars.githubusercontent.com/u/12670864?v=3","gravatar_id":"","url":"https://api.github.com/users/pypyjs","html_url":"https://github.com/pypyjs","followers_url":"https://api.github.com/users/pypyjs/followers","following_url":"https://api.github.com/users/pypyjs/following{/other_user}","gists_url":"https://api.github.com/users/pypyjs/gists{/gist_id}","starred_url":"https://api.github.com/users/pypyjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pypyjs/subscriptions","organizations_url":"https://api.github.com/users/pypyjs/orgs","repos_url":"https://api.github.com/users/pypyjs/repos","events_url":"https://api.github.com/users/pypyjs/events{/privacy}","received_events_url":"https://api.github.com/users/pypyjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pypyjs/pypyjs","description":"PyPy compiled to JavaScript","fork":false,"url":"https://api.github.com/repos/pypyjs/pypyjs","forks_url":"https://api.github.com/repos/pypyjs/pypyjs/forks","keys_url":"https://api.github.com/repos/pypyjs/pypyjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pypyjs/pypyjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pypyjs/pypyjs/teams","hooks_url":"https://api.github.com/repos/pypyjs/pypyjs/hooks","issue_events_url":"https://api.github.com/repos/pypyjs/pypyjs/issues/events{/number}","events_url":"https://api.github.com/repos/pypyjs/pypyjs/events","assignees_url":"https://api.github.com/repos/pypyjs/pypyjs/assignees{/user}","branches_url":"https://api.github.com/repos/pypyjs/pypyjs/branches{/branch}","tags_url":"https://api.github.com/repos/pypyjs/pypyjs/tags","blobs_url":"https://api.github.com/repos/pypyjs/pypyjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pypyjs/pypyjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pypyjs/pypyjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/pypyjs/pypyjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pypyjs/pypyjs/statuses/{sha}","languages_url":"https://api.github.com/repos/pypyjs/pypyjs/languages","stargazers_url":"https://api.github.com/repos/pypyjs/pypyjs/stargazers","contributors_url":"https://api.github.com/repos/pypyjs/pypyjs/contributors","subscribers_url":"https://api.github.com/repos/pypyjs/pypyjs/subscribers","subscription_url":"https://api.github.com/repos/pypyjs/pypyjs/subscription","commits_url":"https://api.github.com/repos/pypyjs/pypyjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/pypyjs/pypyjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/pypyjs/pypyjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/pypyjs/pypyjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/pypyjs/pypyjs/contents/{+path}","compare_url":"https://api.github.com/repos/pypyjs/pypyjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pypyjs/pypyjs/merges","archive_url":"https://api.github.com/repos/pypyjs/pypyjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pypyjs/pypyjs/downloads","issues_url":"https://api.github.com/repos/pypyjs/pypyjs/issues{/number}","pulls_url":"https://api.github.com/repos/pypyjs/pypyjs/pulls{/number}","milestones_url":"https://api.github.com/repos/pypyjs/pypyjs/milestones{/number}","notifications_url":"https://api.github.com/repos/pypyjs/pypyjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pypyjs/pypyjs/labels{/name}","releases_url":"https://api.github.com/repos/pypyjs/pypyjs/releases{/id}","created_at":"2013-12-08T12:14:39Z","updated_at":"2015-11-23T03:01:35Z","pushed_at":"2015-11-26T09:05:47Z","git_url":"git://github.com/pypyjs/pypyjs.git","ssh_url":"git@github.com:pypyjs/pypyjs.git","clone_url":"https://github.com/pypyjs/pypyjs.git","svn_url":"https://github.com/pypyjs/pypyjs","homepage":null,"size":181182,"stargazers_count":911,"watchers_count":911,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":77,"forks":45,"open_issues":77,"watchers":911,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pypyjs/pypyjs/pulls/170"},"html":{"href":"https://github.com/pypyjs/pypyjs/pull/170"},"issue":{"href":"https://api.github.com/repos/pypyjs/pypyjs/issues/170"},"comments":{"href":"https://api.github.com/repos/pypyjs/pypyjs/issues/170/comments"},"review_comments":{"href":"https://api.github.com/repos/pypyjs/pypyjs/pulls/170/comments"},"review_comment":{"href":"https://api.github.com/repos/pypyjs/pypyjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pypyjs/pypyjs/pulls/170/commits"},"statuses":{"href":"https://api.github.com/repos/pypyjs/pypyjs/statuses/48672e6f5d26226ace3ed9359dbf5db588484729"}}}}