Просмотр исходного кода

去掉AOT宏,UNITY_IOS宏替代

tanghai 8 лет назад
Родитель
Сommit
4ac00d5e38

+ 3 - 3
Unity/Assets/Plugins/MongoDB/MongoDB.Bson/Serialization/BsonClassMap.cs

@@ -1277,9 +1277,9 @@ namespace MongoDB.Bson.Serialization
                 ConstructorInfo defaultConstructor = classTypeInfo.GetConstructors(bindingFlags)
                     .Where(c => c.GetParameters().Length == 0)
                     .SingleOrDefault();
-                #if AOT
+#if UNITY_IOS
                 _creator = () => defaultConstructor.Invoke(null);
-                #else
+#else
                 if (defaultConstructor != null)
                 {
                     // lambdaExpression = () => (object) new TClass()
@@ -1298,7 +1298,7 @@ namespace MongoDB.Bson.Serialization
 
                 var lambdaExpression = Expression.Lambda<Func<object>>(body);
                 _creator = lambdaExpression.Compile();
-                #endif
+#endif
             }
             return _creator;
         }

+ 8 - 8
Unity/Assets/Plugins/MongoDB/MongoDB.Bson/Serialization/BsonMemberMap.cs

@@ -16,7 +16,7 @@
 using System;
 using System.Linq.Expressions;
 using System.Reflection;
-#if !AOT
+#if !UNITY_IOS
 using System.Reflection.Emit;		
 #endif
 using MongoDB.Bson.Serialization.Serializers;
@@ -582,7 +582,7 @@ namespace MongoDB.Bson.Serialization
                 throw new BsonSerializationException(message);
             }
 
-#if AOT
+#if UNITY_IOS
 	        return (obj, value) => { fieldInfo.SetValue(obj, value); };
 #else
 			var sourceType = fieldInfo.DeclaringType;
@@ -602,7 +602,7 @@ namespace MongoDB.Bson.Serialization
 
 		private Func<object, object> GetGetter()
         {
-            #if AOT
+#if UNITY_IOS
             PropertyInfo propertyInfo = _memberInfo as PropertyInfo;
             if (propertyInfo != null)
             {
@@ -619,7 +619,7 @@ namespace MongoDB.Bson.Serialization
 
             FieldInfo fieldInfo = _memberInfo as FieldInfo;
             return (obj) => { return fieldInfo.GetValue(obj); };
-            #else
+#else
             var propertyInfo = _memberInfo as PropertyInfo;
             if (propertyInfo != null)
             {
@@ -647,17 +647,17 @@ namespace MongoDB.Bson.Serialization
             );
 
             return lambdaExpression.Compile();
-            #endif
+#endif
         }
 
 
         private Action<object, object> GetPropertySetter()
         {
-            #if AOT
+#if UNITY_IOS
             var propertyInfo = (PropertyInfo) _memberInfo;
 
             return (obj, value) => { propertyInfo.SetValue(obj, value); };
-            #else
+#else
             var propertyInfo = (PropertyInfo)_memberInfo;
             var setMethodInfo = propertyInfo.SetMethod;
             if (IsReadOnly)
@@ -682,7 +682,7 @@ namespace MongoDB.Bson.Serialization
             );
 
             return lambdaExpression.Compile();
-            #endif
+#endif
         }
 
         private void ThrowFrozenException()