Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// prevent descending inner function scope
// AST_Lambda includes all function declarations, such as
// - AST_Defun
// - AST_Accessor
// - AST_Function
if(node instanceof UglifyJS.AST_Lambda){
return node;
}
// there might be more than one `return`s
// @see simple.js
if(node.CTOR === UglifyJS.AST_Return){
return new UglifyJS.AST_Assign({
left: new UglifyJS.AST_Dot({
expression: new UglifyJS.AST_SymbolRef({
name: 'module'
}),
property: 'exports'
}),
operator: '=',
right: node.value
});
}
}
};
//打点
if(!neuronDom.is(dotAST)){
// log(dotAST);
}
// $.forEach = > 不变
if(_property === "forEach"){
// _expression = dotAST.expression;
descend(node,this);
return node;
}else{
//$.count() = >$.length
if(_property === "count"){
_expression = new UglifyJS.AST_Dot({
expression : dotAST.expression,
property : "length"
});
descend(_expression,this);
return _expression;
}
//流水线处理
for (var i = nodes.length; --i >= 0;) {
var item = nodes[i],
node=item.node;
// name=item.name;
//var fullName=getFullName(deps,name);
var replacement;
if (node instanceof U2.AST_New) {
replacement = new U2.AST_New({
expression: new U2.AST_SymbolRef({
name:node.fullName
}),
args: node.args
});
} else if (node instanceof U2.AST_Dot) {
replacement = new U2.AST_Dot({
expression: new U2.AST_SymbolRef({
name: node.fullName
}),
property: node.property
});
}else if(node instanceof U2.AST_SymbolRef){
replacement = new U2.AST_SymbolRef({
name: node.fullName
});
}
var start_pos = node.start.pos;
var end_pos = node.end.endpos;
for (var k = 0; k < nodes.length; k++) {
var item2 = nodes[k];
var otherNode = item2.node;
if (otherNode.start.pos < start_pos && otherNode.end.endpos > end_pos) {
return _expression;
}
//流水线处理
if(map_1[_property]){
_expression = new UglifyJS.AST_Call({
expression: new UglifyJS.AST_Dot({
expression : dotAST.expression,
property : "eq"
}),
args : [
new UglifyJS.AST_Number({
value : 0
})
]
});
}else{
_expression = dotAST.expression;
}
hoisted = hoisted.map(function(defun){
return new u2.AST_SimpleStatement({
body: new u2.AST_Assign({
operator: "=",
left: new u2.AST_Dot({
expression: new u2.AST_SymbolRef({ name: "$__CONTEXT" }),
property: defun.name.name
}),
right: new u2.AST_Function(defun)
})
});
});
node.body = hoisted.concat(node.body);
})
]
}),
cdr: new u2.AST_Call({
expression: new u2.AST_Dot({
expression: node.left.expression,
property: "__defineSetter__"
}),
args: [
prop,
new u2.AST_Lambda({
argnames: [ new u2.AST_SymbolFunarg({ name: "v" }) ],
body: [
new u2.AST_SimpleStatement({
body: new u2.AST_Call({
expression: new u2.AST_Dot({
expression: node.left.expression,
property: "__defineGetter__"
}),
args: [
prop,
new u2.AST_Lambda({
argnames: [],
body: [
new u2.AST_Return({
value: new u2.AST_SymbolRef({ name: "v" })
})
]
})
]
})
})
before: function(node,descend){
if(node.CTOR === UglifyJS.AST_New && node.expression.CTOR === UglifyJS.AST_SymbolRef && node.expression.name === "Class"){
return new UglifyJS.AST_Call({
expression: new UglifyJS.AST_Dot({
expression : new UglifyJS.AST_SymbolRef({
name : "NR"
}),
property: "Class"
}),
args:node.args
});
}
},
function replaceAstDotPrivates(classId, code, privates, globalPrivatesMap) {
var l = privates.length;
while (l--) {
var node = privates[l];
var startPos = node.start.pos;
var endPos = node.end.endpos;
var prop = node.property;
var classIdAndProp = classId+"#"+prop;
globalPrivatesMap[classIdAndProp] = shortenPrivate(classId, prop, globalPrivatesMap);
var replacement = new U2.AST_Dot({
expression : node.expression,
property : globalPrivatesMap[classIdAndProp],
}).print_to_string({ beautify: false });
code = replaceSourceCode(code, startPos, endPos, replacement);
}
return code;
}
if (key.substr(0, 2) === 'on') {
var ast = uglify.parse('jade_interp = (' + attr.val + ')');
var val = ast.body[0].body.right;
if (val.TYPE === 'Call') {
if (val.expression.TYPE !== 'Dot' && val.expression.TYPE !== 'Sub') {
val.expression = new uglify.AST_Dot({
expression: val.expression,
property: 'bind'
});
val.args.unshift(new uglify.AST_Null({}));
attr.val = val.print_to_string();
} else if ((val.expression.TYPE === 'Dot' && val.expression.property !== 'bind') ||
val.expression.TYPE == 'Sub') {
var obj = val.expression.expression;
val.expression.expression = new uglify.AST_SymbolRef({name: 'jade_interp'});
val.expression = new uglify.AST_Dot({
expression: val.expression,
property: 'bind'
});
val.args.unshift(new uglify.AST_SymbolRef({name: 'jade_interp'}));
val = new uglify.AST_Seq({
car: new uglify.AST_Assign({
operator: '=',
left: new uglify.AST_SymbolRef({name: 'jade_interp'}),
right: obj
}),
cdr: val
});
attr.val = '(' + val.print_to_string() + ')';
}
}
}