Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not check if the node itself has effects when checking call effects #2732

Merged
merged 1 commit into from Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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'
);