JS backend: remove isEcma5() from property initialize
This commit is contained in:
+3
-8
@@ -72,7 +72,7 @@ public final class PropertyTranslator extends AbstractTranslator {
|
||||
|
||||
private void translate(@NotNull List<JsPropertyInitializer> result) {
|
||||
List<JsPropertyInitializer> to;
|
||||
if (context().isEcma5() && !JsDescriptorUtils.isExtension(descriptor)) {
|
||||
if (!JsDescriptorUtils.isExtension(descriptor)) {
|
||||
to = new SmartList<JsPropertyInitializer>();
|
||||
result.add(new JsPropertyInitializer(context().nameToLiteral(descriptor), new JsObjectLiteral(to, true)));
|
||||
}
|
||||
@@ -205,12 +205,7 @@ public final class PropertyTranslator extends AbstractTranslator {
|
||||
@NotNull
|
||||
private JsPropertyInitializer generateDefaultAccessor(@NotNull PropertyAccessorDescriptor accessorDescriptor,
|
||||
@NotNull JsFunction function) {
|
||||
if (context().isEcma5()) {
|
||||
return TranslationUtils.translateFunctionAsEcma5PropertyDescriptor(function, accessorDescriptor, context());
|
||||
}
|
||||
else {
|
||||
return new JsPropertyInitializer(context().getNameForDescriptor(accessorDescriptor).makeRef(), function);
|
||||
}
|
||||
return TranslationUtils.translateFunctionAsEcma5PropertyDescriptor(function, accessorDescriptor, context());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -221,6 +216,6 @@ public final class PropertyTranslator extends AbstractTranslator {
|
||||
@NotNull
|
||||
private JsPropertyInitializer translateCustomAccessor(@NotNull JetPropertyAccessor expression) {
|
||||
FunctionTranslator translator = Translation.functionTranslator(expression, context());
|
||||
return context().isEcma5() ? translator.translateAsEcma5PropertyDescriptor() : translator.translateAsMethod();
|
||||
return translator.translateAsEcma5PropertyDescriptor();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public final class InitializerUtils {
|
||||
JsExpression value = Translation.translateAsExpression(delegate, context);
|
||||
String name = property.getName();
|
||||
assert name != null: "Delegate property must have name";
|
||||
return JsAstUtils.defineSimpleProperty(Namer.getDelegateName(name), value, context);
|
||||
return JsAstUtils.defineSimpleProperty(Namer.getDelegateName(name), value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -228,17 +228,8 @@ public final class JsAstUtils {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JsStatement defineSimpleProperty(@NotNull String name, @NotNull JsExpression value, @NotNull TranslationContext context) {
|
||||
if (context.isEcma5()) {
|
||||
return defineProperty(name, createDataDescriptor(value, false, false), context).makeStmt();
|
||||
} else {
|
||||
return assignment(new JsNameRef(name, JsLiteral.THIS), value).makeStmt();
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JsObjectLiteral createDataDescriptor(@NotNull JsExpression value) {
|
||||
return createDataDescriptor(value, false, false);
|
||||
public static JsStatement defineSimpleProperty(@NotNull String name, @NotNull JsExpression value) {
|
||||
return assignment(new JsNameRef(name, JsLiteral.THIS), value).makeStmt();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user