public void createSubConstructors() { var subTypes = Generator.findByBaseType(name); foreach (var subType in subTypes) { var subCTorMemList = new TMemberList(); foreach (var baseMember in members) { if (baseMember.name == "ctor") { var baseCTor = (baseMember as TMethod); if (baseCTor.parameters.Count > 0) { var subCTor = new TMethod(subType); subCTor.name = baseCTor.name; subCTor.resultType = baseCTor.resultType; subCTor.baseMethod = baseCTor; subCTorMemList.Add(subCTor); } } } if (subCTorMemList.Count > 0) { subType.members.InsertRange(0, subCTorMemList); } } }
public void checkGenerateEnumerator() { foreach (var attr in attributes) { if (attr is TNameAttribute) { var nameAttr = attr as TNameAttribute; if (nameAttr.name == "IndexedGetter") { var typeName = ""; foreach (var mem in members) { if (mem.name == "this") { typeName = mem.resultType.ToString(); break; } } if (typeName == "") { return; } jsAttributes.Add("NativeEnumerator", "false"); jsAttributes.Add("NativeArrayEnumerator", "true"); baseType.Add(new TType() { name = "IJsArrayEnumerable", genericType = new TType() { name = typeName }, canCorrect = false }); var str = @" {TYPE} IJsArrayEnumerable<{TYPE}>.this[JsNumber index] { get { throw new NotImplementedException(); } } JsNumber IJsArrayEnumerable<{TYPE}>.length { get { throw new NotImplementedException(); } } System.Collections.Generic.IEnumerator<{TYPE}> System.Collections.Generic.IEnumerable<{TYPE}>.GetEnumerator() { throw new NotImplementedException(); } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw new NotImplementedException(); } "; str = str.Replace("{TYPE}", typeName); members.Add(new TFragmentMember(this) { text = str }); } } } }
private void tryCreateElementMethod(TMemberList memList, string tagName, string typeName) { var mem = createElementMethod(tagName, typeName); if (mem != null) { memList.Add(mem); } }