JS: make JsEmpty singleton

This commit is contained in:
Alexey Tsvetkov
2015-03-26 21:58:34 +03:00
parent dd13e91883
commit efba2a2372
11 changed files with 11 additions and 35 deletions
@@ -4,7 +4,7 @@
package com.google.dart.compiler.backend.js.ast
public class JsEmpty : SourceInfoAwareJsNode(), JsStatement {
public object JsEmpty : SourceInfoAwareJsNode(), JsStatement {
override fun accept(v: JsVisitor) {
v.visitEmpty(this)
@@ -26,7 +26,7 @@ public class JsEmptyExpression extends JsExpressionImpl {
@Override
@NotNull
public JsStatement makeStmt() {
return new JsEmpty();
return JsEmpty.INSTANCE$;
}
@Override
@@ -18,8 +18,6 @@ import static com.google.dart.compiler.backend.js.ast.JsNumberLiteral.JsIntLiter
* A JavaScript program.
*/
public final class JsProgram extends SourceInfoAwareJsNode {
@NotNull
private final JsEmpty emptyStatement;
@NotNull final JsExpression emptyExpression;
private JsProgramFragment[] fragments;
@@ -36,15 +34,9 @@ public final class JsProgram extends SourceInfoAwareJsNode {
topScope = new JsObjectScope(rootScope, "Global", unitId);
setFragmentCount(1);
emptyStatement = new JsEmpty();
emptyExpression = new JsEmptyExpression();
}
@NotNull
public JsEmpty getEmptyStatement() {
return emptyStatement;
}
@NotNull
public JsExpression getEmptyExpression() {
return emptyExpression;