[Transforms] Optimize frequent paths in visitEachChild.#8873
Conversation
|
@vladima gave me a thumbs-up offline, but I'll wait till later tonight before merging in case anyone else has comments. |
|
|
||
| export function createCall(expression: Expression, argumentsArray: Expression[], location?: TextRange) { | ||
| const node = <CallExpression>createNode(SyntaxKind.CallExpression, location); | ||
| export function createCall(expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[], location?: TextRange, flags?: NodeFlags) { |
There was a problem hiding this comment.
Why you need to pass in typeArguments parameter? In the change, it seems that all caller will pass undefined? also since we are in emitting phase, would we typearguments matter, won't we get rid of it anyway?
There was a problem hiding this comment.
Just for consistency. The updateCall function needs typeArguments (which will be undefined currently in all cases) to know it needs to create a new CallExpression when we remove typeArguments during transformation. It's not the responsibility of updateCall to remove it for you. Since you could pass in an actual value for typeArguments to updateCall, it is generally more clear to allow createCall to accept the value. This is to prevent future issues if we reuse this logic elsewhere in the compiler.
|
👍 |
This change addresses performance issues related to the general behavior of
visitEachChild. The currentvisitEachChildfunction is highly generic, which make it difficult for hosts to optimize. This change adds individual, more optimizedvisitEachChildOf*functions for the most common nodes in our current test suite.Also fixes some issues when compiling processDiagnosticMessages following "jake clean".