コード例 #1
0
        public FAMIX.Attribute EnsureField(IFieldSymbol symbol)
        {
            FAMIX.Attribute attribute = this.CreateNewEntity <FAMIX.Attribute>(typeof(FAMIX.Attribute).FullName);
            attribute.accessibility = helper.AccessibilityName(symbol.DeclaredAccessibility);
            attribute.declaredType  = this.EnsureType(symbol.Type);
            attribute.name          = symbol.Name;

            return(attribute);
        }
コード例 #2
0
ファイル: ASTVisitor.cs プロジェクト: lotbr101/roslyn2famix
    private void AddAttributeAccess(SyntaxNode node, Method clientMethod, FAMIX.Attribute attribute)
    {
        Access access = importer.CreateNewAssociation <Access>("FAMIX.Access");

        access.accessor = currentMethod;
        access.variable = attribute;
        clientMethod.AddAccesse(access);
        attribute.AddIncomingAccesse(access);
        importer.CreateSourceAnchor(access, node);
    }
コード例 #3
0
        public FAMIX.Attribute EnsureAnnotationTypeAttribute(FAMIX.AnnotationType annotationType, String attributeName)
        {
            var attributes = annotationType.Attributes.FindAll(a => a.name == attributeName);

            if (attributes.Count() > 0)
            {
                return(attributes[0]);
            }

            FAMIX.Attribute attr = this.CreateNewEntity <FAMIX.Attribute>(typeof(FAMIX.Attribute).FullName);
            attr.name = attributeName;
            annotationType.AddAttribute(attr);
            return(attr);
        }
コード例 #4
0
    private FAMIX.Attribute AddProperty(BasePropertyDeclarationSyntax node, String propertyName)
    {
        ISymbol symbol = importer.model.GetDeclaredSymbol(node);

        FAMIX.Attribute propertyAttribute = null;

        if (currentTypeStack.Count > 0)
        {
            propertyAttribute            = importer.EnsureAttribute(symbol) as FAMIX.Attribute;
            propertyAttribute.parentType = importer.EnsureType(symbol.ContainingType);
            propertyAttribute.parentType.AddAttribute(propertyAttribute);

            propertyAttribute.isStub = false;
            importer.CreateSourceAnchor(propertyAttribute, node);
        }
        return(propertyAttribute);
    }
コード例 #5
0
ファイル: ASTVisitor.cs プロジェクト: lotbr101/roslyn2famix
    private FAMIX.Attribute AddProperty(BasePropertyDeclarationSyntax node, String propertyName)
    {
        ISymbol symbol = semanticModel.GetDeclaredSymbol(node);

        FAMIX.Attribute propertyAttribute = null;

        if (currentTypeStack.Count > 0)
        {
            propertyAttribute = importer.EnsureAttribute(symbol) as FAMIX.Attribute;
            node.Modifiers.ToList <SyntaxToken>().ForEach(token => propertyAttribute.Modifiers.Add(token.Text));
            propertyAttribute.parentType = importer.EnsureType(symbol.ContainingType, typeof(FAMIX.Class));
            propertyAttribute.parentType.AddAttribute(propertyAttribute);

            propertyAttribute.isStub = false;
            importer.CreateSourceAnchor(propertyAttribute, node);
        }
        return(propertyAttribute);
    }
コード例 #6
0
 private void AddField(BaseFieldDeclarationSyntax node)
 {
     foreach (var variable in node.Declaration.Variables)
     {
         string attributeName    = variable.Identifier.ToString();
         var    returnTypeSymbol = importer.model.GetDeclaredSymbol(node.Declaration.Type);
         var    symbol           = importer.model.GetDeclaredSymbol(variable);
         if (symbol is IFieldSymbol || symbol is IEventSymbol)
         {
             if (currentTypeStack.Count > 0)
             {
                 FAMIX.Attribute anAttribute = importer.EnsureAttribute(symbol) as FAMIX.Attribute;
                 anAttribute.parentType = importer.EnsureType(symbol.ContainingType);
                 anAttribute.parentType.AddAttribute(anAttribute);
                 importer.CreateSourceAnchor(anAttribute, node);
                 anAttribute.isStub = false;
             }
         }
     }
 }
コード例 #7
0
ファイル: ASTVisitor.cs プロジェクト: lotbr101/roslyn2famix
    private void AddField(BaseFieldDeclarationSyntax node)
    {
        foreach (var variable in node.Declaration.Variables)
        {
            string attributeName    = variable.Identifier.ToString();
            var    returnTypeSymbol = semanticModel.GetDeclaredSymbol(node.Declaration.Type);

            var symbol = semanticModel.GetDeclaredSymbol(variable);
            if (symbol is IFieldSymbol || symbol is IEventSymbol)
            {
                if (currentTypeStack.Count > 0)
                {
                    FAMIX.Attribute anAttribute = importer.EnsureAttribute(symbol) as FAMIX.Attribute;
                    node.Modifiers.ToList <SyntaxToken>().ForEach(token => anAttribute.Modifiers.Add(token.Text));
                    anAttribute.parentType = importer.EnsureType(symbol.ContainingType, typeof(FAMIX.Class));
                    anAttribute.parentType.AddAttribute(anAttribute);
                    importer.CreateSourceAnchor(anAttribute, node);
                    anAttribute.isStub = false;
                }
            }
        }
    }
コード例 #8
0
ファイル: Type.cs プロジェクト: moosetechnology/roslyn2famix
 public virtual void AddAttribute(FAMIX.Attribute one)
 {
     attributes.Add(one);
 }