// 添加 callee 节点 // 先构造 params let s = t.Identifier('s'); let h = t.Identifier('h'); let params = [s, h];
// 构造 BlockStatement->ReturnStatement->BinaryExpression let binaryExpress = t.BinaryExpression(operator, s, h); let returnStmt = t.ReturnStatement(binaryExpress); let body = t.BlockStatement([returnStmt]);
let id = null const fuuncExpress = t.FunctionExpression(id, params, body);
// 构造 FunctionExpression 节点 let s = t.Identifier('s'); let h = t.Identifier('h'); let params = [s, h] let binaryExpress = t.BinaryExpression(operator, s, h); let returnStmt = t.ReturnStatement(binaryExpress); let blockStmt = t.BlockStatement([returnStmt]); const funcExpress = t.FunctionExpression(id, params,blockStmt)