private void OutputType(ITypeSymbol type, SyntaxNode node, ClassInfo ci, string errorTag) { if (null != type && type.TypeKind != TypeKind.Error) { if (type.TypeKind == TypeKind.TypeParameter) { var typeParam = type as ITypeParameterSymbol; if (typeParam.TypeParameterKind == TypeParameterKind.Type && !m_SkipGenericTypeDefine && null != m_GenericTypeInstance) { IMethodSymbol sym = FindClassMethodDeclaredSymbol(node); if (null != sym) { var t = m_SymbolTable.FindTypeArgument(type); if (t.TypeKind != TypeKind.TypeParameter) { CodeBuilder.Append(ClassInfo.GetFullName(t)); AddReferenceAndTryDeriveGenericTypeInstance(ci, t); } else { CodeBuilder.Append(t.Name); } } else { ISymbol varSym = FindVariableDeclaredSymbol(node); if (null != varSym) { var t = m_SymbolTable.FindTypeArgument(type); if (t.TypeKind != TypeKind.TypeParameter) { CodeBuilder.Append(ClassInfo.GetFullName(t)); AddReferenceAndTryDeriveGenericTypeInstance(ci, t); } else { CodeBuilder.Append(t.Name); } } else { Log(node, "Can't find declaration for type param !", type.Name); } } } else { CodeBuilder.Append(type.Name); } } else if (type.TypeKind == TypeKind.Array) { var arrType = type as IArrayTypeSymbol; CodeBuilder.Append(SymbolTable.PrefixExternClassName("System.Array")); } else { var fullName = ClassInfo.GetFullName(type); CodeBuilder.Append(fullName); var namedType = type as INamedTypeSymbol; if (null != namedType) { AddReferenceAndTryDeriveGenericTypeInstance(ci, namedType); } } } else if (null != type) { CodeBuilder.Append("nil"); ReportIllegalType(node, type); } else { CodeBuilder.Append("nil"); Log(node, "Unknown {0} Type !", errorTag); } }
internal bool IsIgnoredSymbol(ITypeSymbol sym) { return(m_IgnoredTypes.ContainsKey(ClassInfo.GetFullName(sym))); }
internal bool CheckExplicitInterfaceAccess(ISymbol sym, ref string nameOfIntf, ref string mname) { bool ret = false; if (sym.ContainingType.TypeKind == TypeKind.Interface) { string fn = ClassInfo.GetFullName(sym.ContainingType); ClassSymbolInfo csi; if (SymbolTable.Instance.ClassSymbols.TryGetValue(fn, out csi)) { switch (sym.Kind) { case SymbolKind.Method: IMethodSymbol msym = sym as IMethodSymbol; if (csi.ExplicitInterfaceImplementationMethods.Contains(msym)) { ret = true; if (null != nameOfIntf) { nameOfIntf = string.Format("\"{0}\"", fn.Replace(".", "_")); } if (null != mname) { mname = string.Format("\"{0}\"", NameMangling(msym)); } } break; case SymbolKind.Property: IPropertySymbol psym = sym as IPropertySymbol; if (csi.ExplicitInterfaceImplementationProperties.Contains(psym)) { ret = true; if (null != nameOfIntf) { nameOfIntf = string.Format("\"{0}\"", fn.Replace(".", "_")); } if (null != mname) { mname = string.Format("\"{0}\"", SymbolTable.GetPropertyName(psym)); } } break; case SymbolKind.Event: IEventSymbol esym = sym as IEventSymbol; if (csi.ExplicitInterfaceImplementationEvents.Contains(esym)) { ret = true; if (null != nameOfIntf) { nameOfIntf = string.Format("\"{0}\"", fn.Replace(".", "_")); } if (null != mname) { mname = string.Format("\"{0}\"", SymbolTable.GetEventName(esym)); } } break; } } } return(ret); }