MCPcopy Create free account
hub / github.com/babel/babel / parseTopLevel

Function parseTopLevel

packages/babel-parser/src/parser/statement.ts:83–100  ·  view source on GitHub ↗
(
    this: Parser,
    file: Undone<N.File>,
    program: Undone<N.Program>,
  )

Source from the content-addressed store, hash-verified

81 // to its body instead of creating a new node.
82
83 parseTopLevel(
84 this: Parser,
85 file: Undone<N.File>,
86 program: Undone<N.Program>,
87 ): N.File {
88 file.program = this.parseProgram(
89 program,
90 tt.eof,
91 this.options.sourceType === "module" ? "module" : "script",
92 );
93 file.comments = this.comments;
94
95 if (this.optionFlags & OptionFlags.Tokens) {
96 file.tokens = createExportedTokens(this.tokens);
97 }
98
99 return this.finishNode(file, "File");
100 }
101
102 parseProgram(
103 this: Parser,

Callers

nothing calls this directly

Calls 2

createExportedTokensFunction · 0.85
finishNodeMethod · 0.80

Tested by

no test coverage detected