MCPcopy Create free account
hub / github.com/thx/gogocode / constructor

Method constructor

packages/gogocode-core/src/NodePath.js:4–21  ·  view source on GitHub ↗
(node, parent, parentPath)

Source from the content-addressed store, hash-verified

2const visit = recast.types.visit;
3module.exports = class NodePath {
4 constructor(node, parent, parentPath) {
5 if (!parent && !parentPath && node.program) {
6 const nodePath = this;
7 visit(node, {
8 visitFile(path) {
9 ['node', 'value', 'parent', 'get', 'getValueProperty', '__childCache', '__proto__', 'name'].forEach(key => {
10 nodePath[key] = path[key]
11 })
12 this.abort();
13 }
14 })
15 } else {
16 this.node = node;
17 this.parent = parent || null;
18 this.parentPath = parentPath || null;
19 this.value = node;
20 }
21 }
22}

Callers

nothing calls this directly

Calls 1

visitFunction · 0.85

Tested by

no test coverage detected