MCPcopy Index your code
hub / github.com/nodejs/node / emitPrologueDirectives

Function emitPrologueDirectives

test/fixtures/snapshot/typescript.js:113572–113599  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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];

Callers 2

Calls 6

setSourceFileFunction · 0.85
writeLineFunction · 0.70
emitFunction · 0.70
hasMethod · 0.65
addMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected