You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ji...@apache.org on 2019/08/01 06:39:12 UTC
[incubator-weex] branch master updated: [iOS] Convert to immutable
instance. Make code stronger. (#2772)
This is an automated email from the ASF dual-hosted git repository.
jianhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
The following commit(s) were added to refs/heads/master by this push:
new dc63c56 [iOS] Convert to immutable instance. Make code stronger. (#2772)
dc63c56 is described below
commit dc63c56bba86b579fe0633cca56c40366abe1b73
Author: wqyfavor <qi...@alibaba-inc.com>
AuthorDate: Thu Aug 1 14:39:07 2019 +0800
[iOS] Convert to immutable instance. Make code stronger. (#2772)
---
ios/sdk/WeexSDK/Sources/Utility/WXUtility.m | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
index bbc42e0..55db3c1 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
@@ -270,14 +270,16 @@ CGFloat WXFloorPixelValue(CGFloat value)
for (id obj in source) {
[tmpArray addObject:[self convertContainerToImmutable:obj]];
}
- return [NSArray arrayWithArray:tmpArray];
+ id immutableArray = [NSArray arrayWithArray:tmpArray];
+ return immutableArray ? immutableArray : tmpArray;
}
else if ([source isKindOfClass:[NSDictionary class]]) {
NSMutableDictionary* tmpDictionary = [[NSMutableDictionary alloc] init];
for (id key in [source keyEnumerator]) {
tmpDictionary[key] = [self convertContainerToImmutable:[source objectForKey:key]];
}
- return [NSDictionary dictionaryWithDictionary:tmpDictionary];
+ id immutableDict = [NSDictionary dictionaryWithDictionary:tmpDictionary];
+ return immutableDict ? immutableDict : tmpDictionary;
}
return source;