add byte code generation

This commit is contained in:
Mikhail Mutcianko
2014-07-23 18:47:08 +04:00
committed by Yan Zhulanow
parent 7536170e1d
commit 2801253a9c
3 changed files with 57 additions and 0 deletions
@@ -1888,6 +1888,22 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
if (descriptor instanceof PropertyDescriptor) {
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
JetFile file = DescriptorToSourceUtils.getContainingFile(propertyDescriptor);
if (file != null && file.getName() == "ANDROIDXML.kt") {
String userData = (String) file.getUserData(AndroidConst.ANDROID_SYNTHETIC);
String androidPackage = file.getUserData(AndroidConst.ANDROID_USER_PACKAGE);
Type retType = typeMapper.mapType(propertyDescriptor.getReturnType());
v.load(0, Type.getType("Landroid/app/Activity;"));
v.getstatic(androidPackage.replace(".", "/") + "/R$id",
propertyDescriptor.getName().asString(), "I");
v.invokevirtual("android/app/Activity", "findViewById", "(I)" + "Landroid/view/View;");
v.checkcast(retType);
return StackValue.onStack(retType);
}
boolean directToField =
expression.getReferencedNameElementType() == JetTokens.FIELD_IDENTIFIER && contextKind() != OwnerKind.TRAIT_IMPL;
JetExpression r = getReceiverForSelector(expression);