MCPcopy
hub / github.com/ternjs/tern / parseType

Function parseType

plugin/doc_comment.js:243–266  ·  view source on GitHub ↗
(scope, str, pos)

Source from the content-addressed store, hash-verified

241 }
242
243 function parseType(scope, str, pos) {
244 var type, union = false, madeUp = false;
245 for (;;) {
246 var inner = parseTypeAtom(scope, str, pos);
247 if (!inner) return null;
248 madeUp = madeUp || inner.madeUp;
249 if (union) inner.type.propagate(union);
250 else type = inner.type;
251 pos = skipSpace(str, inner.end);
252 if (str.charAt(pos) != "|") break;
253 pos++;
254 if (!union) {
255 union = new infer.AVal;
256 type.propagate(union);
257 type = union;
258 }
259 }
260 var isOptional = false;
261 if (str.charAt(pos) == "=") {
262 ++pos;
263 isOptional = true;
264 }
265 return {type: type, end: pos, isOptional: isOptional, madeUp: madeUp};
266 }
267
268 function parseTypeInner(scope, str, pos) {
269 pos = skipSpace(str, pos);

Callers 4

parseLabelListFunction · 0.70
parseTypeInnerFunction · 0.70
parseTypeOuterFunction · 0.70
jsdocInterpretCommentsFunction · 0.70

Calls 2

parseTypeAtomFunction · 0.85
skipSpaceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…