Skip to content

Commit 2eca5c2

Browse files
fix memory leak cause by fat arrows: ref. jashkenas/coffeescript#3143
1 parent c379a04 commit 2eca5c2

File tree

4 files changed

+66
-45
lines changed

4 files changed

+66
-45
lines changed

lib/compiler.js

+15-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/helpers.js

+25-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/optimiser.js

+22-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/compiler.coffee

+4-4
Original file line numberDiff line numberDiff line change
@@ -646,10 +646,10 @@ class exports.Compiler
646646

647647
fn = new JS.FunctionExpression null, parameters, block
648648
if performedRewrite
649-
new JS.SequenceExpression [
650-
new JS.AssignmentExpression '=', newThis, new JS.ThisExpression
651-
fn
652-
]
649+
new JS.CallExpression (memberAccess (new JS.FunctionExpression null, [], new JS.BlockStatement [
650+
stmt new JS.AssignmentExpression '=', newThis, new JS.ThisExpression
651+
new JS.ReturnStatement fn
652+
]), 'apply'), [new JS.ThisExpression, new JS.Identifier 'arguments']
653653
else fn
654654
]
655655
[CS.Rest, ({expression}) -> {rest: yes, expression, isExpression: yes, isStatement: yes}]

0 commit comments

Comments
 (0)