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

Method isAstMathFunction

src/backend/function-node.js:613–659  ·  view source on GitHub ↗
(ast)

Source from the content-addressed store, hash-verified

611 }
612
613 isAstMathFunction(ast) {
614 const mathFunctions = [
615 'abs',
616 'acos',
617 'acosh',
618 'asin',
619 'asinh',
620 'atan',
621 'atan2',
622 'atanh',
623 'cbrt',
624 'ceil',
625 'clz32',
626 'cos',
627 'cosh',
628 'expm1',
629 'exp',
630 'floor',
631 'fround',
632 'imul',
633 'log',
634 'log2',
635 'log10',
636 'log1p',
637 'max',
638 'min',
639 'pow',
640 'random',
641 'round',
642 'sign',
643 'sin',
644 'sinh',
645 'sqrt',
646 'tan',
647 'tanh',
648 'trunc',
649 ];
650 return ast.type === 'CallExpression' &&
651 ast.callee &&
652 ast.callee.type === 'MemberExpression' &&
653 ast.callee.object &&
654 ast.callee.object.type === 'Identifier' &&
655 ast.callee.object.name === 'Math' &&
656 ast.callee.property &&
657 ast.callee.property.type === 'Identifier' &&
658 mathFunctions.indexOf(ast.callee.property.name) > -1;
659 }
660
661 isAstVariable(ast) {
662 return ast.type === 'Identifier' || ast.type === 'MemberExpression';

Callers 3

getTypeMethod · 0.95
astCallExpressionMethod · 0.80
astCallExpressionMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected