コード例 #1
0
            public override void VisitMethodDeclaration(MethodDeclarationSyntax node)
            {
                base.VisitMethodDeclaration(node);

                string fullName = SyntaxUtils.GetFullName(node) + "::return";
                string type     = node.ReturnType.ToString();

                this.CacheInfo(fullName, type);
            }
コード例 #2
0
            public override void VisitParameter(ParameterSyntax node)
            {
                base.VisitParameter(node);

                string fullName = SyntaxUtils.GetFullName(node);
                string type     = node.Type.ToString();

                this.CacheInfo(node.AttributeLists, fullName, type);
            }
コード例 #3
0
            public override void VisitFieldDeclaration(FieldDeclarationSyntax node)
            {
                if (!(node.Parent is StructDeclarationSyntax))
                {
                    return;
                }

                base.VisitFieldDeclaration(node);

                var    variable = node.Declaration.Variables.First();
                string type     = node.Declaration.Type.ToString();

                string fullName = SyntaxUtils.GetFullName(variable);

                this.CacheInfo(node.AttributeLists, fullName, type);
            }
コード例 #4
0
            private void CacheInfo(SyntaxList <AttributeListSyntax> attributeLists, string fullName, string type)
            {
                string nativeType = SyntaxUtils.GetNativeTypeNameFromAttributesLists(attributeLists);

                // Don't ever map enums onto strings.
                // We may need to make this more intelligent if we find we're stomping on types
                // we don't want to change
                if (nativeType != null && nativeType.Contains("STR"))
                {
                    return;
                }

                this.CacheInfo(fullName, type);

                if (ValidTypeRegex.IsMatch(type))
                {
                    this.map[fullName] = type;
                }
            }