private void SetCustomFields(CppUnresolvedMethodElement oldElement, MethodElement newElement) { foreach (var property in (oldElement as ProgramElement).GetCustomProperties()) { if (!property.Name.Equals(ProgramElement.CustomTypeTag)) { var newProperty = newElement.GetType().GetProperty(property.Name); var oldProperty = oldElement.GetType().GetProperty(property.Name); var oldGet = oldProperty.GetGetMethod(false); var newSet = newProperty.GetSetMethod(); object[] parameters = { oldGet.Invoke(oldElement, null) }; newSet.Invoke(newElement, parameters); } } }
public bool TryResolve(CppUnresolvedMethodElement unresolvedMethod, List <ProgramElement> headerElements, out MethodElement outMethodElement) { AccessLevel accessLevel; Guid classId; outMethodElement = null; if (ResolveClassId(ClassName, headerElements, out classId) == false) { return(false); } if (ResolveAccessType(Name, headerElements, out accessLevel) == false) { return(false); } IsResolved = true; outMethodElement = Activator.CreateInstance(unresolvedMethod.GetResolvedType(), Name, DefinitionLineNumber, DefinitionColumnNumber, FullFilePath, RawSource, accessLevel, Arguments, ReturnType, Body, classId, ClassName, String.Empty, IsConstructor) as MethodElement; SetCustomFields(unresolvedMethod, outMethodElement); return(true); }