private static AbcMethod BuildEnumCinit(AbcFile abc, IType type) { if (type == null) { return(null); } if (!type.IsEnum) { return(null); } var method = new AbcMethod { ReturnType = abc.BuiltinTypes.Void }; var body = new AbcMethodBody(method); abc.AddMethod(method); var code = new AbcCode(abc); var generator = abc.Generator; foreach (var field in type.Fields.Where(field => field.IsConstant)) { code.LoadThis(); code.LoadConstant(field.Value); code.InitProperty(generator.FieldBuilder.GetFieldName(field)); } code.ReturnVoid(); body.Finish(code); return(method); }