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 e8b89cd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Transpile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as ts from "typescript";
import { CompilerOptions } from "./CompilerOptions";
import { transpileError } from "./diagnostics";
import { Block } from './LuaAST';
import { LuaPrinter } from "./LuaPrinter";
import { LuaTransformer } from "./LuaTransformer";
import { TranspileError } from "./TranspileError";
Expand Down Expand Up @@ -36,6 +37,7 @@ function getCustomTransformers(
}

export interface TranspiledFile {
luaAst?: Block;
lua?: string;
sourceMap?: string;
declaration?: string;
Expand Down Expand Up @@ -101,14 +103,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 e8b89cd

Please sign in to comment.