Skip to content

Commit

Permalink
move @babel/helper-optimise-call-expression to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Nov 27, 2020
1 parent 9891c02 commit f8f2cb5
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
import * as t from "@babel/types";
import type {
CallExpression,
Expression,
OptionalCallExpression,
SpreadElement,
} from "@babel/types";

/**
* A helper function that generates a new call expression with given thisNode.
It will also optimize `(...arguments)` to `.apply(arguments)`
*
* @export
* @param {Node} callee The callee of call expression
* @param {Node} thisNode The desired this of call expression
* @param {Node[]} args The arguments of call expression
* @param {Expression} callee The callee of call expression
* @param {Expression} thisNode The desired this of call expression
* @param {Readonly<Array<Expression | SpreadElement>>} args The arguments of call expression
* @param {boolean} optional Whether the call expression is optional
* @returns {CallExpression | OptionalCallExpression} The generated new call expression
*/
export default function (
callee: Node,
thisNode: Node,
args: Node[],
export default function optimiseCallExpression(
callee: Expression,
thisNode: Expression,
args: Readonly<Array<Expression | SpreadElement>>,
optional: boolean,
): CallExpression | OptionalCallExpression {
if (
Expand Down

0 comments on commit f8f2cb5

Please sign in to comment.