* Emits any prologue directives at the start of a Statement list, returning the * number of prologue directives written to the output.
(statements, sourceFile, seenPrologueDirectives, recordBundleFileSection)
| 113570 | * number of prologue directives written to the output. |
| 113571 | */ |
| 113572 | function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives, recordBundleFileSection) { |
| 113573 | var needsToSetSourceFile = !!sourceFile; |
| 113574 | for (var i = 0; i < statements.length; i++) { |
| 113575 | var statement = statements[i]; |
| 113576 | if (ts.isPrologueDirective(statement)) { |
| 113577 | var shouldEmitPrologueDirective = seenPrologueDirectives ? !seenPrologueDirectives.has(statement.expression.text) : true; |
| 113578 | if (shouldEmitPrologueDirective) { |
| 113579 | if (needsToSetSourceFile) { |
| 113580 | needsToSetSourceFile = false; |
| 113581 | setSourceFile(sourceFile); |
| 113582 | } |
| 113583 | writeLine(); |
| 113584 | var pos = writer.getTextPos(); |
| 113585 | emit(statement); |
| 113586 | if (recordBundleFileSection && bundleFileInfo) |
| 113587 | bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "prologue" /* BundleFileSectionKind.Prologue */, data: statement.expression.text }); |
| 113588 | if (seenPrologueDirectives) { |
| 113589 | seenPrologueDirectives.add(statement.expression.text); |
| 113590 | } |
| 113591 | } |
| 113592 | } |
| 113593 | else { |
| 113594 | // return index of the first non prologue directive |
| 113595 | return i; |
| 113596 | } |
| 113597 | } |
| 113598 | return statements.length; |
| 113599 | } |
| 113600 | function emitUnparsedPrologues(prologues, seenPrologueDirectives) { |
| 113601 | for (var _a = 0, prologues_1 = prologues; _a < prologues_1.length; _a++) { |
| 113602 | var prologue = prologues_1[_a]; |