diff options
author | ASDAlexander77 <duzhar@googlemail.com> | 2023-06-01 17:22:42 +0100 |
---|---|---|
committer | ASDAlexander77 <duzhar@googlemail.com> | 2023-06-01 17:22:42 +0100 |
commit | 93b6b4b96f6404494f9ff8ec4969afdb6854aed1 (patch) | |
tree | 2809b648c11edb3dbfd0914af6caf53c1d40ad2d /lib/compilers/typescript-native.ts | |
parent | 0edd00ab63b7ef9d16ae1d7cf9f8cc3df60c589e (diff) | |
download | compiler-explorer-93b6b4b96f6404494f9ff8ec4969afdb6854aed1.tar.gz compiler-explorer-93b6b4b96f6404494f9ff8ec4969afdb6854aed1.zip |
support for tsc version 33 and above
Diffstat (limited to 'lib/compilers/typescript-native.ts')
-rw-r--r-- | lib/compilers/typescript-native.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/compilers/typescript-native.ts b/lib/compilers/typescript-native.ts index 32017f66b..d09a018e5 100644 --- a/lib/compilers/typescript-native.ts +++ b/lib/compilers/typescript-native.ts @@ -36,6 +36,7 @@ export class TypeScriptNativeCompiler extends BaseCompiler { tscJit: string; tscSharedLib: string; + tscVersion: string; constructor(compilerInfo: PreliminaryCompilerInfo, env) { super(compilerInfo, env); @@ -45,6 +46,7 @@ export class TypeScriptNativeCompiler extends BaseCompiler { this.tscJit = this.compilerProps<string>(`compiler.${this.compiler.id}.exe`); this.tscSharedLib = this.compilerProps<string>(`compiler.${this.compiler.id}.sharedlibs`); + this.tscVersion = /tsc-\d+\.\d+-pre-alpha(\d+)/g.exec(this.tscJit)?.[1] || "0"; } override getSharedLibraryPathsAsArguments() { @@ -102,7 +104,12 @@ export class TypeScriptNativeCompiler extends BaseCompiler { override async generateIR(inputFilename: string, options: string[], filters: ParseFiltersAndOutputOptions) { // These options make Clang produce an IR - const newOptions = ['--emit=llvm', inputFilename]; + let newOptions = ['--emit=llvm', inputFilename]; + const newVersion = parseInt(this.tscVersion) >= 33; + if (newVersion) + { + newOptions = ['--emit=llvm', "-o=-", inputFilename]; + } if (!this.tscSharedLib) { newOptions.push('-nogc'); @@ -126,7 +133,7 @@ export class TypeScriptNativeCompiler extends BaseCompiler { filters.libraryCode = true; filters.directives = true; - const ir = await this.llvmIr.process(output.stderr, filters); + const ir = await this.llvmIr.process(newVersion ? output.stdout : output.stderr, filters); return ir.asm; } |