diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-09-16 22:22:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-16 22:22:43 +0200 |
commit | 6c4da0e429eb47dae6a220c5576a39f137615bb8 (patch) | |
tree | a8715428caea00105acc9a10fcd0f356085d3fa7 /cli/tsc/99_main_compiler.js | |
parent | 104aebdfb5d01f7482bacef6d58c2ce16da44334 (diff) |
refactor: remove dispatch_json.js from cli/rt and cli/tsc (#7521)
Instead use Deno.core.jsonOpSync and Deno.core.jsonOpAsync
Diffstat (limited to 'cli/tsc/99_main_compiler.js')
-rw-r--r-- | cli/tsc/99_main_compiler.js | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index 80f7b2233..e5abbd144 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -17,9 +17,8 @@ delete Object.prototype.__proto__; ((window) => { - const core = Deno.core; + const core = window.Deno.core; const { assert, log, notImplemented } = window.__bootstrap.util; - const dispatchJson = window.__bootstrap.dispatchJson; const util = window.__bootstrap.util; const errorStack = window.__bootstrap.errorStack; const errors = window.__bootstrap.errors.errors; @@ -78,7 +77,7 @@ delete Object.prototype.__proto__; } function opNow() { - const res = dispatchJson.sendSync("op_now"); + const res = core.jsonOpSync("op_now"); return res.seconds * 1e3 + res.subsecNanos / 1e6; } @@ -1252,7 +1251,7 @@ delete Object.prototype.__proto__; } function opCompilerRespond(msg) { - dispatchJson.sendSync("op_compiler_respond", msg); + core.jsonOpSync("op_compiler_respond", msg); } async function tsCompilerOnMessage(msg) { @@ -1292,21 +1291,12 @@ delete Object.prototype.__proto__; } } - // TODO(bartlomieju): temporary solution, must be fixed when moving - // dispatches to separate crates - function initOps() { - const opsMap = core.ops(); - for (const [_name, opId] of Object.entries(opsMap)) { - core.setAsyncHandler(opId, dispatchJson.asyncMsgFromRust); - } - } - function runtimeStart(source) { - initOps(); + core.ops(); // First we send an empty `Start` message to let the privileged side know we // are ready. The response should be a `StartRes` message containing the CLI // args and other info. - const s = dispatchJson.sendSync("op_start"); + const s = core.jsonOpSync("op_start"); util.setLogDebug(s.debugFlag, source); errorStack.setPrepareStackTrace(Error); return s; |