Skip to content

Commit

Permalink
fix(tsickle): put the tsickle support code at EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored and tbosch committed May 3, 2016
1 parent 6eac4b6 commit 3cfe281
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions tools/compiler_cli/src/compiler_host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ import {convertDecorators} from 'tsickle';
import {NodeReflectorHost} from './reflector_host';
import {AngularCompilerOptions} from './codegen';

const DEBUG = false;
function debug(msg: string, ...o: any[]) {
if (DEBUG) console.log(msg, ...o);
}

/**
* Implementation of CompilerHost that forwards all methods to another instance.
* Useful for partial implementations to override only methods they care about.
Expand Down Expand Up @@ -37,11 +32,12 @@ export abstract class DelegatingHost implements ts.CompilerHost {
export class TsickleHost extends DelegatingHost {
// Additional diagnostics gathered by pre- and post-emit transformations.
public diagnostics: ts.Diagnostic[] = [];
private TSICKLE_SUPPORT = `interface DecoratorInvocation {
type: Function;
args?: any[];
}
`;
private TSICKLE_SUPPORT = `
interface DecoratorInvocation {
type: Function;
args?: any[];
}
`;
constructor(delegate: ts.CompilerHost, private options: ts.CompilerOptions) { super(delegate); }

getSourceFile =
Expand All @@ -53,8 +49,7 @@ export class TsickleHost extends DelegatingHost {
if (converted.diagnostics) {
this.diagnostics.push(...converted.diagnostics);
}
newContent = this.TSICKLE_SUPPORT + converted.output;
debug(newContent);
newContent = converted.output + this.TSICKLE_SUPPORT;
}
return ts.createSourceFile(fileName, newContent, languageVersion, true);
}
Expand Down

0 comments on commit 3cfe281

Please sign in to comment.