public IEnumerable <ExportedMethodSymbolWrapper> GetNonNativeExportedMethods(GenerationEnvironment env) { foreach (var method in GetMethods()) { if (method.TryGetExportAttribute(out var attribute)) { env.errorContext.PushThing(method); if (attribute.Chain != null) { var m = new ExportedMethodSymbolWrapper(method, attribute); if (m.TryInit(env)) { yield return(m); } } else { // For now, add this check here but it should probably be elsewhere // Report an error if the class is not a behavior. if (!(this is BehaviorSymbolWrapper)) { env.ReportError($"The class {ClassName} marked a method for export but did not specify the chain path. Note: one may omit the chain path only if the method being exported is inside a behavior class."); } env.errorContext.PopThing(); yield break; } env.errorContext.PopThing(); } } }
private IEnumerable <ExportedMethodSymbolWrapper> GetAllExportedMethods(GenerationEnvironment env) { foreach (var method in GetMethods()) { if (method.TryGetExportAttribute(out var attribute)) { // If the chain string is null, it means that the methods reference the behavior // class they are defined in. // TODO: This actually does have to specify the chain, just without the behavior class part. // Either specify these two separately, as in Chain = "Do", Behavior = "Attackable" // Or split by dot at this point. if (attribute.Chain is null) { var m = new ExportedMethodSymbolWrapper(method, attribute); if (m.TryInit(env, Chains.First())) { yield return(m); } } else { var m = new ExportedMethodSymbolWrapper(method, attribute); if (m.TryInit(env)) { yield return(m); } } } } }