Skip to content

Commit c0738ed

Browse files
committed
Correct asc output stream typings, fixes AssemblyScript#485
1 parent 34d86a0 commit c0738ed

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

cli/asc.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ export const definitionFiles: { assembly: string, portable: string };
4242
export interface OutputStream {
4343
/** Writes another chunk of data to the stream. */
4444
write(chunk: Uint8Array | string): void;
45+
}
46+
47+
/** An in-memory output stream. */
48+
export interface MemoryStream extends OutputStream {
49+
/** Resets the stream to offset zero. */
50+
reset(): void;
4551
/** Converts the output to a buffer. */
4652
toBuffer(): Uint8Array;
4753
/** Converts the output to a string. */
@@ -112,7 +118,7 @@ export function formatTime(time: number): string;
112118
export function printStats(stats: Stats, output: OutputStream): void;
113119

114120
/** Creates a memory stream that can be used in place of stdout/stderr. */
115-
export function createMemoryStream(fn?: (chunk: Uint8Array | string) => void): OutputStream;
121+
export function createMemoryStream(fn?: (chunk: Uint8Array | string) => void): MemoryStream;
116122

117123
/** Compatible TypeScript compiler options for syntax highlighting etc. */
118124
export const tscOptions: { [key: string]: any };

cli/asc.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -756,24 +756,6 @@ exports.main = function main(argv, options, callback) {
756756
}
757757
}
758758

759-
var argumentSubstitutions = {
760-
"-O" : [ "--optimize" ],
761-
"-Os" : [ "--optimize", "--shrinkLevel", "1" ],
762-
"-Oz" : [ "--optimize", "--shrinkLevel", "2" ],
763-
"-O0" : [ "--optimizeLevel", "0", "--shrinkLevel", "0" ],
764-
"-O0s": [ "--optimizeLevel", "0", "--shrinkLevel", "1" ],
765-
"-O0z": [ "--optimizeLevel", "0", "--shrinkLevel", "2" ],
766-
"-O1" : [ "--optimizeLevel", "1", "--shrinkLevel", "0" ],
767-
"-O1s": [ "--optimizeLevel", "1", "--shrinkLevel", "1" ],
768-
"-O1z": [ "--optimizeLevel", "1", "--shrinkLevel", "2" ],
769-
"-O2" : [ "--optimizeLevel", "2", "--shrinkLevel", "0" ],
770-
"-O2s": [ "--optimizeLevel", "2", "--shrinkLevel", "1" ],
771-
"-O2z": [ "--optimizeLevel", "2", "--shrinkLevel", "2" ],
772-
"-O3" : [ "--optimizeLevel", "3", "--shrinkLevel", "0" ],
773-
"-O3s": [ "--optimizeLevel", "3", "--shrinkLevel", "1" ],
774-
"-O3z": [ "--optimizeLevel", "3", "--shrinkLevel", "2" ],
775-
};
776-
777759
/** Checks diagnostics emitted so far for errors. */
778760
function checkDiagnostics(emitter, stderr) {
779761
var diagnostic;

0 commit comments

Comments
 (0)