using System.Collections.Generic; namespace UdonSharp.Compiler { [System.Serializable] public class FieldDefinition { public FieldDefinition(SymbolDefinition symbol) { fieldSymbol = symbol; fieldAttributes = new List(); } public SymbolDefinition fieldSymbol; public List fieldAttributes; public UnityEditor.MonoScript userBehaviourSource; public T GetAttribute() where T : System.Attribute { System.Type attributeType = typeof(T); foreach (var attribute in fieldAttributes) { if (attribute is T) return (T)attribute; } return null; } public T[] GetAttributes() where T : System.Attribute { System.Type attributeType = typeof(T); List attributes = new List(); foreach (var attribute in fieldAttributes) { if (attribute is T) attributes.Add((T)attribute); } return attributes.ToArray(); } } public class ClassDefinition { // Methods and fields should *not* be reflected off of this type, it is not guaranteed to be up to date public System.Type userClassType; public UnityEditor.MonoScript classScript; public List fieldDefinitions = new List(); public List methodDefinitions = new List(); } }