public override void VisitMethodDeclaration(MethodDeclarationSyntax node) { base.VisitMethodDeclaration(node); string fullName = SyntaxUtils.GetFullName(node) + "::return"; string type = node.ReturnType.ToString(); this.CacheInfo(fullName, type); }
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); }
public override void VisitStructDeclaration(StructDeclarationSyntax node) { if (this.nameOptions.HasFlag(NameOptions.Structs)) { if (!SyntaxUtils.IsEmptyStruct(node)) { this.AddNameToMap(node); } } // Don't process the node as we don't want nested structs }
private void AddNameToMap(SyntaxNode node) { string name = SyntaxUtils.GetFullName(node, false); if (!string.IsNullOrEmpty(name)) { if (!this.constantsNames.Contains(name)) { this.constantsNames.Add(name); } } }
private void AddNameToMap(SyntaxNode node) { string name = SyntaxUtils.GetFullName(node, false); string ns = SyntaxUtils.GetEnclosingNamespace(node); if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(ns)) { if (!this.namesToNamespaces.ContainsKey(name)) { this.namesToNamespaces.Add(name, ns); } } }
private void AddNameToMap(FieldDeclarationSyntax node) { string name = SyntaxUtils.GetFullName(node, false); if (!string.IsNullOrEmpty(name)) { if (!this.constantsNamesAndTypes.ContainsKey(name)) { var typeName = node.Declaration.Type.ToString(); this.constantsNamesAndTypes.Add(name, typeName); } } }
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); }
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; } }