public static void Compile(string name, TypeBuilder dataClass, ITypedExpression typedExpression, DataDeclaration data, IMetadataContainer container, IRuntimeContainer runtimeContainer) { var method = dataClass.DefineMethod(name, MethodAttributes.Public | MethodAttributes.Static, null, Type.EmptyTypes); if (data.TypeParameters.Any()) { method.DefineGenericParameters(data.TypeParameters.ToArray()); } var converter = new TypeConverter(runtimeContainer, method.GetGenericArguments()); var converted = converter.Convert(data.Type); method.SetReturnType(converted); var body = method.GetILGenerator(); typedExpression.AcceptVisitor(new DataCompiler(body, method.GetGenericArguments(), runtimeContainer)); body.Emit(OpCodes.Ret); container.Add(name, data); runtimeContainer.Add(name, method); RemoveFirstParameter(name, dataClass, method, new IType[0], data.Type, data.TypeParameters, runtimeContainer); }