Skip to content

Commit

Permalink
Fix #5378, stack overflow on large files (#5380)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyBooth committed Oct 2, 2021
1 parent e82de9c commit d572d74
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docs/v2/browser-compiler-legacy/coffeescript.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/v2/browser-compiler-modern/coffeescript.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/coffeescript-browser-compiler-legacy/coffeescript.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/coffeescript-browser-compiler-modern/coffeescript.js

Large diffs are not rendered by default.

13 changes: 3 additions & 10 deletions lib/coffeescript/nodes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions src/nodes.coffee
Expand Up @@ -528,13 +528,8 @@ exports.Root = class Root extends Base
@initializeScope o
fragments = @body.compileRoot o
return fragments if o.bare
parts = []
parts.push @makeCode '('
parts.push @makeCode 'async ' if @isAsync
parts.push @makeCode 'function() {\n'
parts.push ...fragments
parts.push @makeCode '\n}).call(this);\n'
[].concat ...parts
functionKeyword = "#{if @isAsync then 'async ' else ''}function"
[].concat @makeCode("(#{functionKeyword}() {\n"), fragments, @makeCode("\n}).call(this);\n")

initializeScope: (o) ->
o.scope = new Scope null, @body, null, o.referencedVars ? []
Expand Down

0 comments on commit d572d74

Please sign in to comment.