Commit e8b12be1 authored by Andrew Twyman's avatar Andrew Twyman

Merge pull request #124 from NachoSoto/copy-collections

Objective-C generated classes copy collection types in constructor
parents eceef098 f33951e6
......@@ -187,6 +187,9 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
def checkMutable(tm: MExpr): Boolean = tm.base match {
case MOptional => checkMutable(tm.args.head)
case MString => true
case MList => true
case MSet => true
case MMap => true
case MBinary => true
case _ => false
}
......
......@@ -9,7 +9,7 @@
- (nonnull instancetype)initWithDatesById:(nonnull NSDictionary<NSString *, NSDate *> *)datesById
{
if (self = [super init]) {
_datesById = datesById;
_datesById = [datesById copy];
}
return self;
}
......
......@@ -9,7 +9,7 @@
- (nonnull instancetype)initWithMapList:(nonnull NSArray<NSDictionary<NSString *, NSNumber *> *> *)mapList
{
if (self = [super init]) {
_mapList = mapList;
_mapList = [mapList copy];
}
return self;
}
......
......@@ -10,8 +10,8 @@
imap:(nonnull NSDictionary<NSNumber *, NSNumber *> *)imap
{
if (self = [super init]) {
_map = map;
_imap = imap;
_map = [map copy];
_imap = [imap copy];
}
return self;
}
......
......@@ -9,7 +9,7 @@
- (nonnull instancetype)initWithSetList:(nonnull NSArray<NSSet<NSString *> *> *)setList
{
if (self = [super init]) {
_setList = setList;
_setList = [setList copy];
}
return self;
}
......
......@@ -9,7 +9,7 @@
- (nonnull instancetype)initWithList:(nonnull NSArray<NSNumber *> *)list
{
if (self = [super init]) {
_list = list;
_list = [list copy];
}
return self;
}
......
......@@ -10,8 +10,8 @@
iset:(nonnull NSSet<NSNumber *> *)iset
{
if (self = [super init]) {
_set = set;
_iset = iset;
_set = [set copy];
_iset = [iset copy];
}
return self;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment