use of org.jetbrains.kotlin.types.expressions.DoubleColonLHS in project kotlin by JetBrains.
the class ExpressionCodegen method visitClassLiteralExpression.
@Override
public StackValue visitClassLiteralExpression(@NotNull KtClassLiteralExpression expression, StackValue data) {
KtExpression receiverExpression = expression.getReceiverExpression();
assert receiverExpression != null : "Class literal expression should have a left-hand side";
DoubleColonLHS lhs = bindingContext.get(DOUBLE_COLON_LHS, receiverExpression);
assert lhs != null : "Class literal expression should have LHS resolved";
return generateClassLiteralReference(lhs, receiverExpression, /* wrapIntoKClass = */
true);
}
use of org.jetbrains.kotlin.types.expressions.DoubleColonLHS in project kotlin by JetBrains.
the class ExpressionVisitor method visitClassLiteralExpression.
@Override
public JsNode visitClassLiteralExpression(@NotNull KtClassLiteralExpression expression, TranslationContext context) {
KtExpression receiverExpression = expression.getReceiverExpression();
assert receiverExpression != null : "Class literal expression should have a left-hand side";
DoubleColonLHS lhs = context.bindingContext().get(DOUBLE_COLON_LHS, receiverExpression);
assert lhs != null : "Class literal expression should have LHS resolved";
if (lhs instanceof DoubleColonLHS.Expression && !((DoubleColonLHS.Expression) lhs).isObjectQualifier()) {
JsExpression receiver = translateAsExpression(receiverExpression, context);
KotlinType type = context.bindingContext().getType(receiverExpression);
if (type != null && KotlinBuiltIns.isChar(type)) {
receiver = JsAstUtils.charToBoxedChar(receiver);
}
return new JsInvocation(context.namer().kotlin(GET_KCLASS_FROM_EXPRESSION), receiver);
}
return new JsInvocation(context.namer().kotlin(GET_KCLASS), UtilsKt.getReferenceToJsClass(lhs.getType(), context));
}
Aggregations