Skip to content

Commit

Permalink
Do not check if the node itself has effects when checking call effects,
Browse files Browse the repository at this point in the history
resolves #2729 (#2732)
  • Loading branch information
lukastaegert committed Mar 1, 2019
1 parent 4ba9054 commit 43ed3c8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ast/nodes/CallExpression.ts
Expand Up @@ -178,10 +178,10 @@ export default class CallExpression extends NodeBase implements DeoptimizableEnt
options: ExecutionPathOptions
): boolean {
if (options.hasReturnExpressionBeenCalledAtPath(path, this)) return false;
const innerOptions = options.addCalledReturnExpressionAtPath(path, this);
return (
this.hasEffects(innerOptions) ||
this.returnExpression.hasEffectsWhenCalledAtPath(path, callOptions, innerOptions)
return this.returnExpression.hasEffectsWhenCalledAtPath(
path,
callOptions,
options.addCalledReturnExpressionAtPath(path, this)
);
}

Expand Down
@@ -0,0 +1,3 @@
module.exports = {
description: 'handles nested property calls with acceptable performance'
};
43 changes: 43 additions & 0 deletions test/function/samples/nested-property-call-performance/main.js
@@ -0,0 +1,43 @@
assert.equal(
'u'
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat('')
.concat(''),
'u'
);

0 comments on commit 43ed3c8

Please sign in to comment.