Skip EmptyStatements in module initializers
This change skips emitting EmptyStatements into module initializers. This serves no purpose and can in fact lead to us creating module initializers that are nothing but a set of EmptyStatements, slowing down initialization of them with no purpose.
This commit is contained in:
parent
8b1a814d17
commit
2097ab2f19
|
@ -390,8 +390,12 @@ export class Transformer {
|
|||
this.currentModuleMembers[member.name.ident] = member;
|
||||
}
|
||||
else {
|
||||
// This is a top-level module statement; place it into the module initializer.
|
||||
statements.push(<ast.Statement>element);
|
||||
// This is a top-level module statement; place it into the module initializer. Note that we
|
||||
// skip empty statements just to avoid superfluously polluting the module with initializers.
|
||||
let stmt = <ast.Statement>element;
|
||||
if (stmt.kind !== ast.emptyStatementKind) {
|
||||
statements.push(stmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -287,9 +287,6 @@
|
|||
"body": {
|
||||
"kind": "Block",
|
||||
"statements": [
|
||||
{
|
||||
"kind": "EmptyStatement"
|
||||
},
|
||||
{
|
||||
"kind": "BinaryOperatorExpression",
|
||||
"left": {
|
||||
|
|
Loading…
Reference in a new issue