Search in sources :

Example 6 with JsNameRef

use of org.jetbrains.kotlin.js.backend.ast.JsNameRef in project kotlin by JetBrains.

the class VariableAccessTranslator method translateAsGet.

@NotNull
@Override
public JsExpression translateAsGet() {
    JsExpression e = CallTranslator.INSTANCE.translateGet(context(), resolvedCall, receiver);
    CallableDescriptor original = resolvedCall.getResultingDescriptor().getOriginal();
    if (original instanceof PropertyDescriptor) {
        PropertyGetterDescriptor getter = ((PropertyDescriptor) original).getGetter();
        if (InlineUtil.isInline(getter)) {
            if (e instanceof JsNameRef) {
                // Get was translated as a name reference
                setInlineCallMetadata((JsNameRef) e, referenceExpression, getter);
            } else {
                setInlineCallMetadata(e, referenceExpression, getter, context());
            }
        }
    }
    return e;
}
Also used : JsExpression(org.jetbrains.kotlin.js.backend.ast.JsExpression) JsNameRef(org.jetbrains.kotlin.js.backend.ast.JsNameRef) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

JsNameRef (org.jetbrains.kotlin.js.backend.ast.JsNameRef)6 JsExpression (org.jetbrains.kotlin.js.backend.ast.JsExpression)5 NotNull (org.jetbrains.annotations.NotNull)4 JsInvocation (org.jetbrains.kotlin.js.backend.ast.JsInvocation)2 JsName (org.jetbrains.kotlin.js.backend.ast.JsName)2 ArrayList (java.util.ArrayList)1 FunctionDescriptor (org.jetbrains.kotlin.descriptors.FunctionDescriptor)1 PropertyDescriptor (org.jetbrains.kotlin.descriptors.PropertyDescriptor)1 VariableDescriptor (org.jetbrains.kotlin.descriptors.VariableDescriptor)1 JsStatement (org.jetbrains.kotlin.js.backend.ast.JsStatement)1 JsVars (org.jetbrains.kotlin.js.backend.ast.JsVars)1 KtDestructuringDeclarationEntry (org.jetbrains.kotlin.psi.KtDestructuringDeclarationEntry)1 KotlinType (org.jetbrains.kotlin.types.KotlinType)1