MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / storeRef

Function storeRef

lib/web/tern/tern.js:1005–1024  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

1003
1004 var type, refs = [];
1005 function storeRef(file) {
1006 return function(node, scopeHere, ancestors) {
1007 var value = {file: file.name,
1008 start: outputPos(query, file, node.start),
1009 end: outputPos(query, file, node.end)}
1010 if (isRename) {
1011 for (var s = scopeHere; s != scope; s = s.prev) {
1012 var exists = s.hasProp(isRename);
1013 if (exists)
1014 throw ternError("Renaming `" + name + "` to `" + isRename + "` would make a variable at line " +
1015 (asLineChar(file, node.start).line + 1) + " point to the definition at line " +
1016 (asLineChar(file, exists.name.start).line + 1));
1017 }
1018 var parent = ancestors[ancestors.length - 2]
1019 if (parent && parent.type == "Property" && parent.key == parent.value)
1020 value.isShorthand = true
1021 }
1022 refs.push(value);
1023 };
1024 }
1025
1026 if (scope.originNode) {
1027 type = "local";

Callers 2

findRefsToVariableFunction · 0.85
findRefsToPropertyFunction · 0.85

Calls 3

ternErrorFunction · 0.85
asLineCharFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected