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

Function parseTopLevel

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

Source from the content-addressed store, hash-verified

93 // to its body instead of creating a new node.
94
95 parseTopLevel(
96 this: Parser,
97 file: Undone<N.File>,
98 program: Undone<N.Program>,
99 ): N.File {
100 file.program = this.parseProgram(
101 program,
102 tt.eof,
103 this.options.sourceType === "module" ? "module" : "script",
104 );
105 file.comments = this.comments;
106
107 if (this.optionFlags & OptionFlags.Tokens) {
108 file.tokens = createExportedTokens(this.tokens);
109 }
110
111 return this.finishNode(file, "File");
112 }
113
114 parseProgram(
115 this: Parser,

Callers

nothing calls this directly

Calls 2

createExportedTokensFunction · 0.85
finishNodeMethod · 0.80

Tested by

no test coverage detected