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

Function appendReferenceToType

test/fixtures/snapshot/typescript.js:52972–53013  ·  view source on GitHub ↗
(root, ref)

Source from the content-addressed store, hash-verified

52970 }
52971 }
52972 function appendReferenceToType(root, ref) {
52973 if (ts.isImportTypeNode(root)) {
52974 // first shift type arguments
52975 var typeArguments = root.typeArguments;
52976 var qualifier = root.qualifier;
52977 if (qualifier) {
52978 if (ts.isIdentifier(qualifier)) {
52979 qualifier = ts.factory.updateIdentifier(qualifier, typeArguments);
52980 }
52981 else {
52982 qualifier = ts.factory.updateQualifiedName(qualifier, qualifier.left, ts.factory.updateIdentifier(qualifier.right, typeArguments));
52983 }
52984 }
52985 typeArguments = ref.typeArguments;
52986 // then move qualifiers
52987 var ids = getAccessStack(ref);
52988 for (var _i = 0, ids_1 = ids; _i < ids_1.length; _i++) {
52989 var id = ids_1[_i];
52990 qualifier = qualifier ? ts.factory.createQualifiedName(qualifier, id) : id;
52991 }
52992 return ts.factory.updateImportTypeNode(root, root.argument, qualifier, typeArguments, root.isTypeOf);
52993 }
52994 else {
52995 // first shift type arguments
52996 var typeArguments = root.typeArguments;
52997 var typeName = root.typeName;
52998 if (ts.isIdentifier(typeName)) {
52999 typeName = ts.factory.updateIdentifier(typeName, typeArguments);
53000 }
53001 else {
53002 typeName = ts.factory.updateQualifiedName(typeName, typeName.left, ts.factory.updateIdentifier(typeName.right, typeArguments));
53003 }
53004 typeArguments = ref.typeArguments;
53005 // then move qualifiers
53006 var ids = getAccessStack(ref);
53007 for (var _a = 0, ids_2 = ids; _a < ids_2.length; _a++) {
53008 var id = ids_2[_a];
53009 typeName = ts.factory.createQualifiedName(typeName, id);
53010 }
53011 return ts.factory.updateTypeReferenceNode(root, typeName, typeArguments);
53012 }
53013 }
53014 function getAccessStack(ref) {
53015 var state = ref.typeName;
53016 var ids = [];

Callers 2

typeToTypeNodeHelperFunction · 0.85
typeReferenceToTypeNodeFunction · 0.85

Calls 1

getAccessStackFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…