Skip to content

Commit d572d74

Browse files
Fix #5378, stack overflow on large files (#5380)
1 parent e82de9c commit d572d74

File tree

6 files changed

+9
-21
lines changed

6 files changed

+9
-21
lines changed

docs/v2/browser-compiler-legacy/coffeescript.js

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

docs/v2/browser-compiler-modern/coffeescript.js

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

lib/coffeescript-browser-compiler-legacy/coffeescript.js

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

lib/coffeescript-browser-compiler-modern/coffeescript.js

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

lib/coffeescript/nodes.js

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

src/nodes.coffee

+2-7
Original file line numberDiff line numberDiff line change
@@ -528,13 +528,8 @@ exports.Root = class Root extends Base
528528
@initializeScope o
529529
fragments = @body.compileRoot o
530530
return fragments if o.bare
531-
parts = []
532-
parts.push @makeCode '('
533-
parts.push @makeCode 'async ' if @isAsync
534-
parts.push @makeCode 'function() {\n'
535-
parts.push ...fragments
536-
parts.push @makeCode '\n}).call(this);\n'
537-
[].concat ...parts
531+
functionKeyword = "#{if @isAsync then 'async ' else ''}function"
532+
[].concat @makeCode("(#{functionKeyword}() {\n"), fragments, @makeCode("\n}).call(this);\n")
538533

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

0 commit comments

Comments
 (0)