/// <summary> /// Adds the given fields to the given type. /// </summary> /// <param name="type">The entity to add the fields to.</param> /// <param name="fields">A list of fields to add.</param> private void AddFields(SingleInharitanceType type, IEnumerable <NRField> fields) { foreach (NRField nrField in fields) { type.AddField().InitFromDeclaration(new NRFieldDeclaration(nrField)); } }
/// <summary> /// Adds the given fields to the given type. /// </summary> /// <param name="type">The entity to add the fields to.</param> /// <param name="fields">A list of fields to add.</param> private void AddFields(SingleInharitanceType type, IEnumerable <NRField> fields) { foreach (var nrField in fields) { type.AddField().InitFromString(nrField.Declaration()); } }
/// <summary> /// Adds the given fields to the given type. /// </summary> /// <param name="type">The entity to add the fields to.</param> /// <param name="tp">.</param> private void AddFields(SingleInharitanceType type, TypeDeclaration tp) { foreach (FieldDeclaration fp in tp.Descendants.OfType <FieldDeclaration>()) { var variable = fp.Variables.First(); if (variable == null) { continue; } Field fld = type.AddField(); fld.Name = variable.Name; fld.AccessModifier = fp.Modifiers.ToEnClass(); fld.Type = fp.ReturnType.ToString(); fld.InitialValue = variable.LastChild.ToString(); } }