diff options
Diffstat (limited to 'Runtime/Export/UnityEngineInternal/TypeInferenceRuleAttribute.cs')
-rw-r--r-- | Runtime/Export/UnityEngineInternal/TypeInferenceRuleAttribute.cs | 52 |
1 files changed, 52 insertions, 0 deletions
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 + { + /// <summary> + /// (typeof(T)) as T + /// </summary> + TypeReferencedByFirstArgument, + + /// <summary> + /// (, typeof(T)) as T + /// </summary> + TypeReferencedBySecondArgument, + + /// <summary> + /// (typeof(T)) as (T) + /// </summary> + ArrayOfTypeReferencedByFirstArgument, + + /// <summary> + /// (T) as T + /// </summary> + TypeOfFirstArgument, + } + + /// <summary> + /// Adds a special type inference rule to a method. + /// </summary> + [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 |