public void Visit(ITypeShape ts, ISet <IAssemblyName> apis) { Visit(ts.TypeHierarchy, apis); foreach (var mh in ts.MethodHierarchies) { Visit(mh, apis); } }
protected void RewriteContexts(IEnumerable <Query> queries, ITypeShape typeShape) { foreach (var query in queries) { query.classCtx = GetClassContext(query.classCtx, typeShape.TypeHierarchy); query.methodCtx = GetMethodContext(query.methodCtx, typeShape.MethodHierarchies); } }
private void AddDelegates(ITypeShape typeShape) { var typeMembers = _typeElement.GetMembers(); var delegateTypeNames = typeMembers.OfType <IDelegate>() .Select(d => d.GetName <IDelegateTypeName>()); typeShape.Delegates.AddAll(delegateTypeNames); }
private void AddEventHierarchies(ITypeShape typeShape) { foreach (var e in FindImplementedEventsInType()) { var name = e.GetName <IEventName>(); var declaration = e.CollectDeclarationInfo <IEventName, EventHierarchy>(name); typeShape.EventHierarchies.Add(declaration); } }
private void AddPropertyHierarchies(ITypeShape typeShape) { foreach (var p in FindImplementedPropertiesInType()) { var name = p.GetName <IPropertyName>(); var declaration = p.CollectDeclarationInfo <IPropertyName, PropertyHierarchy>(name); typeShape.PropertyHierarchies.Add(declaration); } }
private void AddNestedTypes(ITypeShape typeShape) { foreach (var typeElement in _typeElement.NestedTypes) { if (typeElement is IDelegate) { continue; } var type = typeElement.GetName <ITypeName>(); typeShape.NestedTypes.Add(type); } }
public ITypeShape Anonymize(ITypeShape typeShape) { return(new TypeShape { TypeHierarchy = AnonymizeCodeNames(typeShape.TypeHierarchy), NestedTypes = Sets.NewHashSetFrom(typeShape.NestedTypes.Select(tn => tn.ToAnonymousName())), Delegates = Sets.NewHashSetFrom(typeShape.Delegates.Select(n => n.ToAnonymousName())), EventHierarchies = Sets.NewHashSetFrom(typeShape.EventHierarchies.Select(AnonymizeCodeNames)), Fields = Sets.NewHashSetFrom(typeShape.Fields.Select(n => n.ToAnonymousName())), MethodHierarchies = Sets.NewHashSetFrom(typeShape.MethodHierarchies.Select(AnonymizeCodeNames)), PropertyHierarchies = Sets.NewHashSetFrom(typeShape.PropertyHierarchies.Select(AnonymizeCodeNames)) }); }
protected void RewriteThisType(IEnumerable <Query> queries, ITypeShape typeShape) { var hasSuper = typeShape.TypeHierarchy.Extends != null; if (hasSuper) { var superType = typeShape.TypeHierarchy.Extends.Element; var allThisQueries = queries.Where(q => q.definition.kind == DefinitionSiteKind.THIS); foreach (var q in allThisQueries) { q.type = superType.ToCoReName(); } } }
private void AddMethodHierarchies(ITypeShape typeShape) { foreach (var m in FindImplementedConstructorsInType()) { var name = m.GetName <IMethodName>(); typeShape.MethodHierarchies.Add(new MethodHierarchy { Element = name }); } foreach (var m in FindImplementedMethodsInType()) { var name = m.GetName <IMethodName>(); var declaration = m.CollectDeclarationInfo <IMethodName, MethodHierarchy>(name); typeShape.MethodHierarchies.Add(declaration); } }
private void AddFields(ITypeShape typeShape) { var typeMembers = _typeElement.GetMembers(); foreach (var typeMember in typeMembers) { var field = typeMember as IField; if (field != null) { var fieldName = field.GetName <IFieldName>(); if (field.IsEnumMember) { var shortName = field.ShortName; fieldName = Names.Field("[{0}] [{0}].{1}", fieldName.DeclaringType, shortName); } typeShape.Fields.Add(fieldName); } } }
private void Add(ITypeShape tS) { var assemblyName = tS.TypeHierarchy.Element.Assembly; _logger.Info("{0}".FormatEx(tS.TypeHierarchy.Element)); if (AssemblyAlreadyExists(assemblyName)) { _logger.Info("\tassembly exists, ignore"); _existingAssemblies.Add(assemblyName); return; } if (_writingArchives.ContainsKey(assemblyName)) { _writingArchives[assemblyName].Add(tS); } else { var zip = GetZipName(assemblyName); _writingArchives.Add(assemblyName, new WritingArchive(zip)); _logger.Info("\tcreated new zip ({0})", zip); } }
public EntryPointSelector(ITypeDeclaration typeDeclaration, ITypeShape typeShape) { _typeDeclaration = typeDeclaration; _typeShape = typeShape; _typeElem = typeDeclaration.DeclaredElement; }