MCPcopy Index your code
hub / github.com/ternjs/tern / storeRef

Function storeRef

lib/tern.js:1070–1089  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

1068
1069 var type, refs = [];
1070 function storeRef(file) {
1071 return function(node, scopeHere, ancestors) {
1072 var value = {file: file.name,
1073 start: outputPos(query, file, node.start),
1074 end: outputPos(query, file, node.end)};
1075 if (isRename) {
1076 for (var s = scopeHere; s != scope; s = s.prev) {
1077 var exists = s.hasProp(isRename);
1078 if (exists)
1079 throw ternError("Renaming `" + name + "` to `" + isRename + "` would make a variable at line " +
1080 (asLineChar(file, node.start).line + 1) + " point to the definition at line " +
1081 (asLineChar(file, exists.name.start).line + 1));
1082 }
1083 var parent = ancestors[ancestors.length - 2];
1084 if (parent && parent.type == "Property" && parent.key == parent.value)
1085 value.isShorthand = true;
1086 }
1087 refs.push(value);
1088 };
1089 }
1090
1091 if (scope.originNode) {
1092 type = "local";

Callers 2

findRefsToVariableFunction · 0.85
findRefsToPropertyFunction · 0.85

Calls 2

ternErrorFunction · 0.85
asLineCharFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…