def _GetObjCUnionNullReturnValue(self, kind): typemap = MojoTypemapForKind(kind) if mojom.IsEnumKind(kind): return 'static_cast<%s>(0)' % typemap.ObjCWrappedType() elif mojom.IsObjectKind(kind) or mojom.IsAnyInterfaceKind(kind): return 'nil' else: return '0'
def _GetObjCPropertyModifiers(self, kind, inside_union=False): modifiers = ['nonatomic'] if (mojom.IsArrayKind(kind) or mojom.IsStringKind(kind) or mojom.IsMapKind(kind) or mojom.IsStructKind(kind)): modifiers.append('copy') if ((inside_union and mojom.IsObjectKind(kind)) or mojom.IsNullableKind(kind)): modifiers.append('nullable') return ', '.join(modifiers)
def IsPointerArrayKind(kind): if not mojom.IsArrayKind(kind): return False sub_kind = kind.kind return mojom.IsObjectKind(sub_kind)
def IsPointer(kind): return mojom.IsObjectKind(kind) and not mojom.IsUnionKind(kind)
def IsObjectField(field): return mojom.IsObjectKind(field.kind)