From c0738ed6b6113bf5d63b9ab9b8647ff8b7c5b2ce Mon Sep 17 00:00:00 2001 From: dcode Date: Thu, 21 Feb 2019 06:16:29 +0100 Subject: [PATCH] Correct asc output stream typings, fixes #485 --- cli/asc.d.ts | 8 +++++++- cli/asc.js | 18 ------------------ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/cli/asc.d.ts b/cli/asc.d.ts index 8ce41fae..8c745f97 100644 --- a/cli/asc.d.ts +++ b/cli/asc.d.ts @@ -42,6 +42,12 @@ export const definitionFiles: { assembly: string, portable: string }; export interface OutputStream { /** Writes another chunk of data to the stream. */ write(chunk: Uint8Array | string): void; +} + +/** An in-memory output stream. */ +export interface MemoryStream extends OutputStream { + /** Resets the stream to offset zero. */ + reset(): void; /** Converts the output to a buffer. */ toBuffer(): Uint8Array; /** Converts the output to a string. */ @@ -112,7 +118,7 @@ export function formatTime(time: number): string; export function printStats(stats: Stats, output: OutputStream): void; /** Creates a memory stream that can be used in place of stdout/stderr. */ -export function createMemoryStream(fn?: (chunk: Uint8Array | string) => void): OutputStream; +export function createMemoryStream(fn?: (chunk: Uint8Array | string) => void): MemoryStream; /** Compatible TypeScript compiler options for syntax highlighting etc. */ export const tscOptions: { [key: string]: any }; diff --git a/cli/asc.js b/cli/asc.js index 840bebbb..151a6c13 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -756,24 +756,6 @@ exports.main = function main(argv, options, callback) { } } -var argumentSubstitutions = { - "-O" : [ "--optimize" ], - "-Os" : [ "--optimize", "--shrinkLevel", "1" ], - "-Oz" : [ "--optimize", "--shrinkLevel", "2" ], - "-O0" : [ "--optimizeLevel", "0", "--shrinkLevel", "0" ], - "-O0s": [ "--optimizeLevel", "0", "--shrinkLevel", "1" ], - "-O0z": [ "--optimizeLevel", "0", "--shrinkLevel", "2" ], - "-O1" : [ "--optimizeLevel", "1", "--shrinkLevel", "0" ], - "-O1s": [ "--optimizeLevel", "1", "--shrinkLevel", "1" ], - "-O1z": [ "--optimizeLevel", "1", "--shrinkLevel", "2" ], - "-O2" : [ "--optimizeLevel", "2", "--shrinkLevel", "0" ], - "-O2s": [ "--optimizeLevel", "2", "--shrinkLevel", "1" ], - "-O2z": [ "--optimizeLevel", "2", "--shrinkLevel", "2" ], - "-O3" : [ "--optimizeLevel", "3", "--shrinkLevel", "0" ], - "-O3s": [ "--optimizeLevel", "3", "--shrinkLevel", "1" ], - "-O3z": [ "--optimizeLevel", "3", "--shrinkLevel", "2" ], -}; - /** Checks diagnostics emitted so far for errors. */ function checkDiagnostics(emitter, stderr) { var diagnostic;