From 18b7109f76a15334a6cd1400b3ac9ee8e21e9171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sat, 26 Sep 2020 15:59:24 +0200 Subject: refactor: prune unneeded JS code (#7689) --- cli/tsc/00_bootstrap_namespace.js | 9 --- cli/tsc/01_errors.js | 154 -------------------------------------- cli/tsc/99_main_compiler.js | 23 ------ 3 files changed, 186 deletions(-) delete mode 100644 cli/tsc/00_bootstrap_namespace.js delete mode 100644 cli/tsc/01_errors.js (limited to 'cli/tsc') diff --git a/cli/tsc/00_bootstrap_namespace.js b/cli/tsc/00_bootstrap_namespace.js deleted file mode 100644 index bccbc09c1..000000000 --- a/cli/tsc/00_bootstrap_namespace.js +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -// The only purpose of this file is to set up "globalThis.__bootstrap" namespace, -// that is used by scripts in this directory to reference exports between -// the files. - -// This namespace is removed during runtime bootstrapping process. - -globalThis.__bootstrap = {}; diff --git a/cli/tsc/01_errors.js b/cli/tsc/01_errors.js deleted file mode 100644 index fb2bb78c2..000000000 --- a/cli/tsc/01_errors.js +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -((window) => { - class NotFound extends Error { - constructor(msg) { - super(msg); - this.name = "NotFound"; - } - } - - class PermissionDenied extends Error { - constructor(msg) { - super(msg); - this.name = "PermissionDenied"; - } - } - - class ConnectionRefused extends Error { - constructor(msg) { - super(msg); - this.name = "ConnectionRefused"; - } - } - - class ConnectionReset extends Error { - constructor(msg) { - super(msg); - this.name = "ConnectionReset"; - } - } - - class ConnectionAborted extends Error { - constructor(msg) { - super(msg); - this.name = "ConnectionAborted"; - } - } - - class NotConnected extends Error { - constructor(msg) { - super(msg); - this.name = "NotConnected"; - } - } - - class AddrInUse extends Error { - constructor(msg) { - super(msg); - this.name = "AddrInUse"; - } - } - - class AddrNotAvailable extends Error { - constructor(msg) { - super(msg); - this.name = "AddrNotAvailable"; - } - } - - class BrokenPipe extends Error { - constructor(msg) { - super(msg); - this.name = "BrokenPipe"; - } - } - - class AlreadyExists extends Error { - constructor(msg) { - super(msg); - this.name = "AlreadyExists"; - } - } - - class InvalidData extends Error { - constructor(msg) { - super(msg); - this.name = "InvalidData"; - } - } - - class TimedOut extends Error { - constructor(msg) { - super(msg); - this.name = "TimedOut"; - } - } - - class Interrupted extends Error { - constructor(msg) { - super(msg); - this.name = "Interrupted"; - } - } - - class WriteZero extends Error { - constructor(msg) { - super(msg); - this.name = "WriteZero"; - } - } - - class UnexpectedEof extends Error { - constructor(msg) { - super(msg); - this.name = "UnexpectedEof"; - } - } - - class BadResource extends Error { - constructor(msg) { - super(msg); - this.name = "BadResource"; - } - } - - class Http extends Error { - constructor(msg) { - super(msg); - this.name = "Http"; - } - } - - class Busy extends Error { - constructor(msg) { - super(msg); - this.name = "Busy"; - } - } - - const errors = { - NotFound, - PermissionDenied, - ConnectionRefused, - ConnectionReset, - ConnectionAborted, - NotConnected, - AddrInUse, - AddrNotAvailable, - BrokenPipe, - AlreadyExists, - InvalidData, - TimedOut, - Interrupted, - WriteZero, - UnexpectedEof, - BadResource, - Http, - Busy, - }; - - window.__bootstrap.errors = { - errors, - }; -})(this); diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index d06912b1f..a6989381d 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -18,7 +18,6 @@ delete Object.prototype.__proto__; ((window) => { const core = window.Deno.core; - const errors = window.__bootstrap.errors.errors; let logDebug = false; let logSource = "JS"; @@ -1345,28 +1344,6 @@ delete Object.prototype.__proto__; throw new Error("Worker runtime already bootstrapped"); } hasBootstrapped = true; - core.registerErrorClass("NotFound", errors.NotFound); - core.registerErrorClass("PermissionDenied", errors.PermissionDenied); - core.registerErrorClass("ConnectionRefused", errors.ConnectionRefused); - core.registerErrorClass("ConnectionReset", errors.ConnectionReset); - core.registerErrorClass("ConnectionAborted", errors.ConnectionAborted); - core.registerErrorClass("NotConnected", errors.NotConnected); - core.registerErrorClass("AddrInUse", errors.AddrInUse); - core.registerErrorClass("AddrNotAvailable", errors.AddrNotAvailable); - core.registerErrorClass("BrokenPipe", errors.BrokenPipe); - core.registerErrorClass("AlreadyExists", errors.AlreadyExists); - core.registerErrorClass("InvalidData", errors.InvalidData); - core.registerErrorClass("TimedOut", errors.TimedOut); - core.registerErrorClass("Interrupted", errors.Interrupted); - core.registerErrorClass("WriteZero", errors.WriteZero); - core.registerErrorClass("UnexpectedEof", errors.UnexpectedEof); - core.registerErrorClass("BadResource", errors.BadResource); - core.registerErrorClass("Http", errors.Http); - core.registerErrorClass("URIError", URIError); - core.registerErrorClass("TypeError", TypeError); - core.registerErrorClass("Other", Error); - core.registerErrorClass("Busy", errors.Busy); - delete globalThis.__bootstrap; runtimeStart("TS"); } -- cgit v1.2.3