public IEnumerable <StructuralError> TryDeclareTypes(ModuleContext context) { typeDelegate = new StructTypeAliasDelegate(context, name, description, fields.Where(e => e.IsRight).Select(e => e.Right).ToList()); if (exported) { context.exportedTypes.Add((name, typeDelegate)); } return(Enumerable.Empty <StructuralError>()); }
public IEnumerable <StructuralError> TryImportTypes(ModuleContext context) { StructTypeAliasDelegate structDelegate = context.mappedTypes.Get(name) as StructTypeAliasDelegate; if (structDelegate == null) { return(new StructuralError( StructuralError.ErrorType.InvalidType, $"Struct with name {name} is not defined", Start, End).Yield()); } foreach (var method in methods) { method.StructType = structDelegate; structDelegate.AddMethod(method.name, method.CreateInvokeFactory()); } return(Enumerable.Empty <StructuralError>()); }