Skip to content

Commit 3be12e8

Browse files
author
Alex D
committed
make text as default
1 parent e1f7da2 commit 3be12e8

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/compiler.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ export class Run {
205205
private generateBinary(
206206
program: ts.Program, sources: string[], outputExtention: string, options: ts.CompilerOptions, cmdLineOptions: any) {
207207

208-
console.log(ForegroundColorEscapeSequences.Pink + 'Generating binary files...' + resetEscapeSequence);
208+
const binOutput = cmdLineOptions && cmdLineOptions.bin;
209+
console.log(ForegroundColorEscapeSequences.Pink + 'Generating ' + (binOutput ? 'Binary' : 'Text') + ' files...' + resetEscapeSequence);
209210

210211
const sourceFiles = program.getSourceFiles();
211212

212-
const textOutput = cmdLineOptions && cmdLineOptions.text;
213213
const isSingleModule = cmdLineOptions && cmdLineOptions.singleModule;
214214
if (!isSingleModule) {
215215
sourceFiles.filter(s => !s.fileName.endsWith('.d.ts') && sources.some(sf => s.fileName.endsWith(sf))).forEach(s => {
@@ -246,7 +246,7 @@ export class Run {
246246
+ ForegroundColorEscapeSequences.White
247247
+ s.fileName
248248
+ resetEscapeSequence);
249-
const emitter = textOutput
249+
const emitter = !binOutput
250250
? new EmitterLua(program.getTypeChecker(), options, cmdLineOptions, false, program.getCurrentDirectory())
251251
: new Emitter(program.getTypeChecker(), options, cmdLineOptions, false, program.getCurrentDirectory());
252252

@@ -267,7 +267,7 @@ export class Run {
267267
fs.writeFileSync(fileName, emitter.writer.getBytes());
268268
});
269269
} else {
270-
const emitter = textOutput
270+
const emitter = !binOutput
271271
? new EmitterLua(program.getTypeChecker(), options, cmdLineOptions, true, program.getCurrentDirectory())
272272
: new Emitter(program.getTypeChecker(), options, cmdLineOptions, true, program.getCurrentDirectory());
273273
sourceFiles.forEach(s => {
@@ -293,7 +293,7 @@ export class Run {
293293
fs.writeFileSync(fileName, emitter.writer.getBytes());
294294
}
295295

296-
console.log(ForegroundColorEscapeSequences.Pink + 'Binary files have been generated...' + resetEscapeSequence);
296+
console.log(ForegroundColorEscapeSequences.Pink + (binOutput ? 'Binary' : 'Text') + ' files have been generated...' + resetEscapeSequence);
297297
}
298298

299299
public test(sources: string[], cmdLineOptions?: any): string {
@@ -302,7 +302,7 @@ export class Run {
302302
const tempSourceFiles = sources.map((s: string, index: number) => 'test' + index + '.ts');
303303
const tempLuaFiles = sources.map((s: string, index: number) => 'test' + index + '.lua');
304304

305-
const textOutput = true;//cmdLineOptions && cmdLineOptions.text;
305+
const binOutput = cmdLineOptions && cmdLineOptions.bin;
306306

307307
// clean up
308308
tempSourceFiles.forEach(f => {
@@ -334,7 +334,7 @@ export class Run {
334334
sourceFiles.forEach((s: ts.SourceFile, index: number) => {
335335
const currentFile = tempSourceFiles.find(sf => s.fileName.endsWith(sf));
336336
if (currentFile) {
337-
const emitter = textOutput
337+
const emitter = !binOutput
338338
? new EmitterLua(program.getTypeChecker(), undefined, cmdLineOptions || {}, false)
339339
: new Emitter(program.getTypeChecker(), undefined, cmdLineOptions || {}, false);
340340
emitter.processNode(s);

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function print() {
2424
Options:
2525
-jslib Use JS library.
2626
-singleModule Output single file.
27-
-text text output instead of byte codes
27+
-bin binary output instead of text
2828
-varAsLet Use all 'var' variables as 'let'.
2929
`);
3030
}

0 commit comments

Comments
 (0)