예제 #1
0
 public void gen(JetProperty p) {
   final VariableDescriptor descriptor = state.getBindingContext().get(BindingContext.VARIABLE, p);
   if (!(descriptor instanceof PropertyDescriptor)) {
     throw new UnsupportedOperationException("expect a property to have a property descriptor");
   }
   final PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
   if (kind == OwnerKind.NAMESPACE
       || kind == OwnerKind.IMPLEMENTATION
       || kind == OwnerKind.TRAIT_IMPL) {
     if (kind != OwnerKind.TRAIT_IMPL) generateBackingField(p, propertyDescriptor);
     generateGetter(p, propertyDescriptor);
     generateSetter(p, propertyDescriptor);
   } else if (kind instanceof OwnerKind.DelegateKind) {
     generateDefaultGetter(propertyDescriptor, Opcodes.ACC_PUBLIC, p);
     if (propertyDescriptor.isVar()) {
       generateDefaultSetter(propertyDescriptor, Opcodes.ACC_PUBLIC, p);
     }
   }
 }