MCPcopy Index your code
hub / github.com/gpujs/gpu.js / getVariableType

Method getVariableType

src/backend/function-node.js:275–296  ·  view source on GitHub ↗

* @desc Return the type of parameter sent to subKernel/Kernel. * @param {Object} ast - Identifier * @returns {String} Type of the parameter

(ast)

Source from the content-addressed store, hash-verified

273 * @returns {String} Type of the parameter
274 */
275 getVariableType(ast) {
276 if (ast.type !== 'Identifier') {
277 throw new Error(`ast of ${ast.type} not "Identifier"`);
278 }
279 let type = null;
280 const argumentIndex = this.argumentNames.indexOf(ast.name);
281 if (argumentIndex === -1) {
282 const declaration = this.getDeclaration(ast);
283 if (declaration) {
284 return declaration.valueType;
285 }
286 } else {
287 const argumentType = this.argumentTypes[argumentIndex];
288 if (argumentType) {
289 type = argumentType;
290 }
291 }
292 if (!type && this.strictTypingChecking) {
293 throw new Error(`Declaration of ${name} not found`);
294 }
295 return type;
296 }
297
298 /**
299 * Generally used to lookup the value type returned from a member expressions

Callers 10

getCheckVariableTypeMethod · 0.95
setupArgumentsMethod · 0.80
setupConstantsMethod · 0.80
getArgumentTypesMethod · 0.80
validateSettingsMethod · 0.80
setupArgumentsMethod · 0.80
setupConstantsMethod · 0.80
validateSettingsMethod · 0.80
validateSettingsMethod · 0.80

Calls 1

getDeclarationMethod · 0.95

Tested by

no test coverage detected