protected override bool Init(GenerationEnvironment env) { // Workaround: If it is marked as ExportingClass, do after init after all inits. if (symbol.HasAttribute(RelevantSymbols.ExportingClassAttribute.symbol)) { return(base.Init(env) && env.TryAddExportingClass(this)); } // If there are no exported methods, this class is unusable anyway // and should be either given another symbol, or thrown away. return(base.Init(env) && base.AfterInit(env) && (exportedMethods.Length > 0 || contributedChains.Length > 0) && env.TryAddExportingClass(this)); }
protected override bool Init(GenerationEnvironment env) { if (symbol.HasAttribute(RelevantSymbols.InstanceExportAttribute.symbol)) { env.ReportError($"Components must not have the InstanceExportAttribute since its usage is ambiguous for components."); return(false); } if (base.Init(env)) { flaggedFields = GetFlaggedFields(); aliasMethods = GetAliasMethods(env); injectedFields = GetInjectedFields().ToArray(); HasInitInWorldMethod = symbol.GetMethods().Any(m => !m.IsStatic && m.Name == "InitInWorld"); return(env.TryAddExportingClass(this)); } return(false); }