How to use the uglify-js-papandreou.AST_Function function in uglify-js-papandreou

To help you get started, we’ve selected a few uglify-js-papandreou examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github assetgraph / assetgraph / lib / assets / JavaScript.js View on Github external
outgoingRelations.push(new AssetGraph.JavaScriptAmdDefine({
                                        from: this,
                                        callNode: node,
                                        arrayNode: arrayNode,
                                        node: arrayItemAst
                                    }));
                                }
                            } else {
                                infos.push(new errors.SyntaxError('Skipping non-string JavaScriptAmdDefine item: ' + node.print_to_string()));
                            }
                        }, this);
                    }
                    // Keep track of the fact that we're in the body of a define(function () {...}) that might contain
                    // JavaScriptRequireJsCommonJsCompatibilityRequire relations
                    var lastArgument = node.args.length > 0 && node.args[node.args.length - 1];
                    if (lastArgument && lastArgument instanceof uglifyJs.AST_Function) {
                        nestedDefineNodes.push(node);
                        descend();
                        nestedDefineNodes.pop();
                        return true; // Tell the TreeWalker not to descend again
                    }
                } else if (node.expression instanceof uglifyJs.AST_Symbol && node.expression.name === 'require' &&
                           node.args.length === 1 && node.args[0] instanceof uglifyJs.AST_String) {
                    if (nestedDefineNodes.length > 0) {
                        var parentDefineNode = nestedDefineNodes[nestedDefineNodes.length - 1];
                        if (!(parentDefineNode.args[0] instanceof uglifyJs.AST_String)) {
                            outgoingRelations.push(new AssetGraph.JavaScriptRequireJsCommonJsCompatibilityRequire({
                                parentDefineNode: parentDefineNode,
                                requireJsConfig: this.assetGraph && this.assetGraph.requireJsConfig, // Hmmm
                                from: this,
                                node: node
                            }));
github assetgraph / assetgraph / lib / assets / JavaScript.js View on Github external
}.bind(this);

                    var stackPosition = stack.length - 1;
                    while (stack[stackPosition - 1] instanceof uglifyJs.AST_Dot && stack[stackPosition - 2] instanceof uglifyJs.AST_Call) {
                        var callNode = stack[stackPosition - 2],
                            methodName = stack[stackPosition - 1].property,
                            argumentNodes = callNode.args,
                            templateCacheVariableName;

                        if (methodName === 'run' &&
                            argumentNodes.length > 0 &&
                            argumentNodes[0] instanceof uglifyJs.AST_Array &&
                            argumentNodes[0].elements.length === 2 &&
                            argumentNodes[0].elements[0] instanceof uglifyJs.AST_String &&
                            argumentNodes[0].elements[0].value === '$templateCache' &&
                            argumentNodes[0].elements[1] instanceof uglifyJs.AST_Function) {

                            templateCacheVariableName = argumentNodes[0].elements[1].argnames[0].name;
                        }
                        diveIntoAngularMethodCall(argumentNodes, templateCacheVariableName);
                        stackPosition -= 2;
                    }
                }

                if (node.expression instanceof uglifyJs.AST_Symbol && node.expression.name === 'INCLUDE') {
                    if (node.args.length === 1 && node.args[0] instanceof uglifyJs.AST_String) {
                        outgoingRelations.push(new AssetGraph.JavaScriptInclude({
                            from: this,
                            to: {
                                url: node.args[0].value
                            },
                            node: node,