Direct property access for object properties.

This commit is contained in:
Pavel V. Talanov
2012-08-13 15:29:14 +04:00
parent ac87d8497a
commit 60f6762578
@@ -249,9 +249,8 @@ public final class CallTranslator extends AbstractTranslator {
@Override @Override
public JsExpression construct(@Nullable JsExpression receiver) { public JsExpression construct(@Nullable JsExpression receiver) {
JsExpression qualifiedCallee = getQualifiedCallee(receiver); JsExpression qualifiedCallee = getQualifiedCallee(receiver);
if (isDirectPropertyAccess()) {
if (isEcma5PropertyAccess()) { return directPropertyAccess(qualifiedCallee);
return ecma5PropertyAccess(qualifiedCallee);
} }
return new JsInvocation(qualifiedCallee, arguments); return new JsInvocation(qualifiedCallee, arguments);
@@ -260,7 +259,7 @@ public final class CallTranslator extends AbstractTranslator {
} }
@NotNull @NotNull
private JsExpression ecma5PropertyAccess(@NotNull JsExpression callee) { private JsExpression directPropertyAccess(@NotNull JsExpression callee) {
if (descriptor instanceof PropertyGetterDescriptor) { if (descriptor instanceof PropertyGetterDescriptor) {
assert arguments.isEmpty(); assert arguments.isEmpty();
return callee; return callee;
@@ -272,8 +271,9 @@ public final class CallTranslator extends AbstractTranslator {
} }
} }
private boolean isEcma5PropertyAccess() { private boolean isDirectPropertyAccess() {
return context().isEcma5() && descriptor instanceof PropertyAccessorDescriptor; return descriptor instanceof PropertyAccessorDescriptor &&
(context().isEcma5() || ((PropertyAccessorDescriptor) descriptor).getCorrespondingProperty().isObjectDeclaration());
} }
@NotNull @NotNull