(constants, types)
| 1 | const { utils } = require('../../utils'); |
| 2 | |
| 3 | function constantsToString(constants, types) { |
| 4 | const results = []; |
| 5 | for (const name in types) { |
| 6 | if (!types.hasOwnProperty(name)) continue; |
| 7 | const type = types[name]; |
| 8 | const constant = constants[name]; |
| 9 | switch (type) { |
| 10 | case 'Number': |
| 11 | case 'Integer': |
| 12 | case 'Float': |
| 13 | case 'Boolean': |
| 14 | results.push(`${name}:${constant}`); |
| 15 | break; |
| 16 | case 'Array(2)': |
| 17 | case 'Array(3)': |
| 18 | case 'Array(4)': |
| 19 | case 'Matrix(2)': |
| 20 | case 'Matrix(3)': |
| 21 | case 'Matrix(4)': |
| 22 | results.push(`${name}:new ${constant.constructor.name}(${JSON.stringify(Array.from(constant))})`); |
| 23 | break; |
| 24 | } |
| 25 | } |
| 26 | return `{ ${ results.join() } }`; |
| 27 | } |
| 28 | |
| 29 | function cpuKernelString(cpuKernel, name) { |
| 30 | const header = []; |
no outgoing calls
no test coverage detected
searching dependent graphs…