コード例 #1
0
        private void LinkWithInheritance(FAMIX.Type subClass, FAMIX.Type superClass)
        {
            Inheritance inheritance = CreateNewAssociation <Inheritance>(typeof(FAMIX.Inheritance).FullName);

            inheritance.subclass   = subClass;
            inheritance.superclass = superClass;
            superClass.AddSubInheritance(inheritance);
            subClass.AddSuperInheritance(inheritance);
        }
コード例 #2
0
ファイル: ASTVisitor.cs プロジェクト: lotbr101/roslyn2famix
 private void AddSuperInterfaces(INamedTypeSymbol typeSymbol, FAMIX.Type type)
 {
     foreach (var inter in typeSymbol.Interfaces)
     {
         FAMIX.Type fInterface = (FAMIX.Type)importer.EnsureType(inter, typeof(FAMIX.Class));
         if (fInterface is FAMIX.Class)
         {
             (fInterface as FAMIX.Class).isInterface = true;
         }
         Inheritance inheritance = importer.CreateNewAssociation <Inheritance>("FAMIX.Inheritance");
         inheritance.subclass   = type;
         inheritance.superclass = fInterface;
         fInterface.AddSubInheritance(inheritance);
         type.AddSuperInheritance(inheritance);
     }
 }
コード例 #3
0
ファイル: ASTVisitor.cs プロジェクト: lotbr101/roslyn2famix
    public override void VisitClassDeclaration(ClassDeclarationSyntax node)
    {
        var typeSymbol = semanticModel.GetDeclaredSymbol(node);

        FAMIX.Type type = type = importer.EnsureType(typeSymbol, typeof(FAMIX.Class));
        node.Modifiers.ToList <SyntaxToken>().ForEach(token => type.Modifiers.Add(token.Text));
        var superType = typeSymbol.BaseType;

        if (superType != null)
        {
            FAMIX.Type baseType = null;
            if (superType.DeclaringSyntaxReferences.Length == 0)
            {
                baseType = importer.EnsureBinaryType(superType);
            }
            else
            {
                baseType = importer.EnsureType(typeSymbol.BaseType, typeof(FAMIX.Class));
            }
            Inheritance inheritance = importer.CreateNewAssociation <Inheritance>(typeof(FAMIX.Inheritance).FullName);
            inheritance.subclass   = type;
            inheritance.superclass = baseType;
            baseType.AddSubInheritance(inheritance);
            type.AddSuperInheritance(inheritance);
        }

        //type.name = node.Identifier.ToString();
        AddSuperInterfaces(typeSymbol, type);
        AddAnnotations(typeSymbol, type);
        AddParameterTypes(typeSymbol, type);
        currentTypeStack.Push(type);
        importer.CreateSourceAnchor(type, node);
        type.isStub = false;
        if (type.container != null)
        {
            type.container.isStub = false;
        }
        base.VisitClassDeclaration(node);
        ComputeFanout(currentTypeStack.Peek() as FAMIX.Type);
        currentTypeStack.Pop();
    }