(printers: Printer[])
| 83 | } |
| 84 | |
| 85 | export function createPrinter(printers: Printer[]): Printer { |
| 86 | if (printers.length === 0) { |
| 87 | return (program, emitHost, fileName, file) => new LuaPrinter(emitHost, program, fileName).print(file); |
| 88 | } else if (printers.length === 1) { |
| 89 | return printers[0]; |
| 90 | } else { |
| 91 | throw new Error("Only one plugin can specify 'printer'"); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | export class LuaPrinter { |
| 96 | private static operatorMap: Record<lua.Operator, string> = { |
no test coverage detected