Skip to content

Commit

Permalink
Add Lua AST to TranspiledFile interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ark120202 committed May 2, 2019
1 parent d5b8e65 commit be51ac2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Transpile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function getCustomTransformers(
}

export interface TranspiledFile {
luaAst?: Block;
lua?: string;
sourceMap?: string;
declaration?: string;
Expand Down Expand Up @@ -101,14 +102,14 @@ export function transpile({

const processSourceFile = (sourceFile: ts.SourceFile) => {
try {
const [luaAST, lualibFeatureSet] = transformer.transformSourceFile(sourceFile);
const [luaAst, lualibFeatureSet] = transformer.transformSourceFile(sourceFile);
if (!options.noEmit && !options.emitDeclarationOnly) {
const [lua, sourceMap] = printer.print(
luaAST,
luaAst,
lualibFeatureSet,
sourceFile.fileName
);
updateTranspiledFile(sourceFile.fileName, { lua, sourceMap });
updateTranspiledFile(sourceFile.fileName, { luaAst, lua, sourceMap });
}
} catch (err) {
if (!(err instanceof TranspileError)) throw err;
Expand Down

0 comments on commit be51ac2

Please sign in to comment.