internal static void GenerateIntrinsic(List <ASMetaData> src, StringBuilder sb, string nl, string tab) { if (src == null) { return; } foreach (var meta in src) { if (meta.Kind == ASMetaKind.Include) { sb.Append(meta.RawParams).Append(nl); } else if (meta.Kind != ASMetaKind.Unknown) { sb.Append(ClassModel.CommentDeclaration(meta.Comments, tab)); sb.Append(tab).Append('[').Append(meta.Name).Append('(').Append(meta.RawParams).Append(")] ").Append(nl).Append(nl); } } }
public string GenerateIntrinsic(bool caching) { if (this == FileModel.Ignore) { return(""); } StringBuilder sb = new StringBuilder(); string nl = (caching) ? "" : "\r\n"; char semi = ';'; string tab = (caching) ? "" : "\t"; // header if (Version > 2) { sb.Append("package"); if (Package.Length > 0) { sb.Append(" ").Append(Package); } if (haXe) { sb.Append(semi).Append(nl).Append(nl); } else { sb.Append(nl).Append("{").Append(nl); } } // imports if (Imports.Count > 0) { foreach (MemberModel import in Imports) { sb.Append(tab).Append("import ").Append(import.Type).Append(semi).Append(nl); } sb.Append(nl); } // event/style metadatas if (MetaDatas != null) { foreach (ASMetaData meta in MetaDatas) { if (meta.Kind == ASMetaKind.Include) { sb.Append(meta.RawParams).Append(nl); } else if (meta.Kind != ASMetaKind.Unknown) { sb.Append(ClassModel.CommentDeclaration(meta.Comments, tab)); sb.Append(tab).Append('[').Append(meta.Name).Append('(').Append(meta.RawParams).Append(")] ").Append(nl).Append(nl); } } } // members string decl; foreach (MemberModel member in Members) { if ((member.Flags & FlagType.Variable) > 0) { sb.Append(ClassModel.CommentDeclaration(member.Comments, tab)); sb.Append(tab).Append(ClassModel.MemberDeclaration(member)).Append(semi).Append(nl); } else if ((member.Flags & FlagType.Function) > 0) { decl = ClassModel.MemberDeclaration(member); sb.Append(ClassModel.CommentDeclaration(member.Comments, tab)); sb.Append(tab).Append(decl).Append(semi).Append(nl); } } foreach (ClassModel aClass in Classes) { sb.Append(aClass.GenerateIntrinsic(caching)); sb.Append(nl); } if (Version == 3) { sb.Append('}').Append(nl); } return(sb.ToString()); }