parent
e82de9c0f6
commit
d572d744eb
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -723,7 +723,7 @@
|
|||
// better not to generate them in the first place, but for now, clean up
|
||||
// obvious double-parentheses.
|
||||
compileNode(o) {
|
||||
var fragments, parts;
|
||||
var fragments, functionKeyword;
|
||||
o.indent = o.bare ? '' : TAB;
|
||||
o.level = LEVEL_TOP;
|
||||
o.compiling = true;
|
||||
|
@ -732,15 +732,8 @@
|
|||
if (o.bare) {
|
||||
return fragments;
|
||||
}
|
||||
parts = [];
|
||||
parts.push(this.makeCode('('));
|
||||
if (this.isAsync) {
|
||||
parts.push(this.makeCode('async '));
|
||||
}
|
||||
parts.push(this.makeCode('function() {\n'));
|
||||
parts.push(...fragments);
|
||||
parts.push(this.makeCode('\n}).call(this);\n'));
|
||||
return [].concat(...parts);
|
||||
functionKeyword = `${this.isAsync ? 'async ' : ''}function`;
|
||||
return [].concat(this.makeCode(`(${functionKeyword}() {\n`), fragments, this.makeCode("\n}).call(this);\n"));
|
||||
}
|
||||
|
||||
initializeScope(o) {
|
||||
|
|
|
@ -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 ? []
|
||||
|
|
Loading…
Reference in New Issue