From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- .../TypeInferenceRuleAttribute.cs | 52 ++++++++++++++++++++++ Runtime/Export/UnityEngineInternal/WrappedTypes.cs | 20 +++++++++ 2 files changed, 72 insertions(+) create mode 100644 Runtime/Export/UnityEngineInternal/TypeInferenceRuleAttribute.cs create mode 100644 Runtime/Export/UnityEngineInternal/WrappedTypes.cs (limited to 'Runtime/Export/UnityEngineInternal') diff --git a/Runtime/Export/UnityEngineInternal/TypeInferenceRuleAttribute.cs b/Runtime/Export/UnityEngineInternal/TypeInferenceRuleAttribute.cs new file mode 100644 index 0000000..f2c7fc2 --- /dev/null +++ b/Runtime/Export/UnityEngineInternal/TypeInferenceRuleAttribute.cs @@ -0,0 +1,52 @@ +using System; + +namespace UnityEngineInternal +{ + public enum TypeInferenceRules + { + /// + /// (typeof(T)) as T + /// + TypeReferencedByFirstArgument, + + /// + /// (, typeof(T)) as T + /// + TypeReferencedBySecondArgument, + + /// + /// (typeof(T)) as (T) + /// + ArrayOfTypeReferencedByFirstArgument, + + /// + /// (T) as T + /// + TypeOfFirstArgument, + } + + /// + /// Adds a special type inference rule to a method. + /// + [Serializable] + [AttributeUsage(AttributeTargets.Method)] + public class TypeInferenceRuleAttribute : Attribute + { + private readonly string _rule; + + public TypeInferenceRuleAttribute(TypeInferenceRules rule) + : this(rule.ToString()) + { + } + + public TypeInferenceRuleAttribute(string rule) + { + _rule = rule; + } + + public override string ToString() + { + return _rule; + } + } +} \ No newline at end of file diff --git a/Runtime/Export/UnityEngineInternal/WrappedTypes.cs b/Runtime/Export/UnityEngineInternal/WrappedTypes.cs new file mode 100644 index 0000000..54c2444 --- /dev/null +++ b/Runtime/Export/UnityEngineInternal/WrappedTypes.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +namespace UnityEngineInternal +{ + // This is a solution to problem where we cannot use: + // * System.Collections.Stack on WP8 and Metro, because it was stripped from .NET + // * System.Collections.Generic.Stack cannot use on iOS because it creates a dependency to System.dll thus increasing overall executable size +#if UNITY_WINRT + public class GenericStack : Stack + { + + } +#else + public class GenericStack : System.Collections.Stack + { + + } +#endif + +} \ No newline at end of file -- cgit v1.1-26-g67d0