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
2 changed files with 6 additions and 5 deletions
|
@ -390,8 +390,12 @@ export class Transformer {
|
||||||
this.currentModuleMembers[member.name.ident] = member;
|
this.currentModuleMembers[member.name.ident] = member;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// This is a top-level module statement; place it into the module initializer.
|
// This is a top-level module statement; place it into the module initializer. Note that we
|
||||||
statements.push(<ast.Statement>element);
|
// 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": {
|
"body": {
|
||||||
"kind": "Block",
|
"kind": "Block",
|
||||||
"statements": [
|
"statements": [
|
||||||
{
|
|
||||||
"kind": "EmptyStatement"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"kind": "BinaryOperatorExpression",
|
"kind": "BinaryOperatorExpression",
|
||||||
"left": {
|
"left": {
|
||||||
|
|
Loading…
Reference in a new issue