MCPcopy Create free account
hub / github.com/prettier/prettier / parse

Function parse

src/language-js/parse/angular.js:50–76  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

48 return {
49 astFormat: "estree",
50 parse(text) {
51 /** @type {Exclude<ReturnType<ParseMethod>, TupleTypeAnnotation>} */
52 let node;
53
54 try {
55 // @ts-expect-error -- safe
56 node = parseMethod(text);
57 } catch (error) {
58 throw createParseError(error);
59 }
60
61 // @ts-expect-error -- safe
62 const { comments } = node;
63 // @ts-expect-error -- safe
64 delete node.comments;
65
66 if (parseMethod === parseAction && node.type !== "NGChainedExpression") {
67 node = { ...node, type: "NGChainedExpression", expressions: [node] };
68 }
69
70 return wrapExpression({
71 type: "NGRoot",
72 expression: node,
73 comments,
74 text,
75 });
76 },
77 locStart,
78 locEnd,
79 };

Callers

nothing calls this directly

Calls 2

wrapExpressionFunction · 0.85
createParseErrorFunction · 0.70

Tested by

no test coverage detected