MCPcopy Create free account
hub / github.com/gpujs/gpu.js / getDeclaration

Method getDeclaration

src/backend/function-tracer.js:101–117  ·  view source on GitHub ↗

* @param {string} name * @returns {IDeclaration}

(name)

Source from the content-addressed store, hash-verified

99 * @returns {IDeclaration}
100 */
101 getDeclaration(name) {
102 const { currentContext, currentFunctionContext, runningContexts } = this;
103 const declaration = currentContext[name] || currentFunctionContext[name] || null;
104
105 if (
106 !declaration &&
107 currentContext === currentFunctionContext &&
108 runningContexts.length > 0
109 ) {
110 const previousRunningContext = runningContexts[runningContexts.length - 2];
111 if (previousRunningContext[name]) {
112 return previousRunningContext[name];
113 }
114 }
115
116 return declaration;
117 }
118
119 /**
120 * Recursively scans AST for declarations and functions, and add them to their respective context

Callers 1

scanMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected