public InstantiatedParameterType (ProjectDom dom, ITypeParameterMember typeParameterMember, ITypeParameter tp) { IType outerType = typeParameterMember as IType ?? typeParameterMember.DeclaringType; typeparam = tp; compilationUnit = outerType.CompilationUnit; ClassType = ClassType.Class; Modifiers = Modifiers.Public; Name = tp.Name; Namespace = outerType.DecoratedFullName; Location = outerType.Location; DeclaringType = outerType; if (tp.Constraints.Count > 0) ClassType = ClassType.Interface; foreach (IReturnType rt in tp.Constraints) { if (FindCyclicReference (new HashSet<ITypeParameter> () { tp }, outerType, ((DomReturnType)rt).DecoratedFullName)) continue; IType bt = dom.SearchType (typeParameterMember, rt); IReturnType resolvedType = rt; if (bt != null) { resolvedType = new DomReturnType (bt); if (bt.ClassType == ClassType.Interface || BaseType != null) { AddInterfaceImplementation (resolvedType); } else { ClassType = bt.ClassType; BaseType = resolvedType; } } else { AddInterfaceImplementation (resolvedType); } } if (BaseType == null) BaseType = DomReturnType.Object; }
public int GetParameterCount(int overload) { if (overload < 0 || overload >= OverloadCount) { return(0); } ITypeParameterMember type = types[overload] is InstantiatedType ? ((InstantiatedType)types[overload]).UninstantiatedType : types[overload]; return(type.TypeParameters.Count); }
public string GetParameterMarkup(int overload, int paramIndex) { ITypeParameterMember type = types[overload] is InstantiatedType ? ((InstantiatedType)types[overload]).UninstantiatedType : types[overload]; if (paramIndex < 0 || paramIndex >= type.TypeParameters.Count) { return(""); } return(type.TypeParameters[paramIndex].Name); //ambience.GetString (, OutputFlags.AssemblyBrowserDescription | OutputFlags.HideExtensionsParameter | OutputFlags.IncludeGenerics | OutputFlags.IncludeModifiers | OutputFlags.HighlightName); }
public InstantiatedParameterType(ProjectDom dom, ITypeParameterMember typeParameterMember, ITypeParameter tp) { IType outerType = typeParameterMember as IType ?? typeParameterMember.DeclaringType; typeparam = tp; compilationUnit = outerType.CompilationUnit; ClassType = ClassType.Class; Modifiers = Modifiers.Public; Name = tp.Name; Namespace = outerType.DecoratedFullName; Location = outerType.Location; DeclaringType = outerType; if (tp.ValueTypeRequired) { BaseType = new DomReturnType("System.ValueType"); } if (tp.Constraints.Count > 0) { ClassType = ClassType.Interface; } foreach (IReturnType rt in tp.Constraints) { if (FindCyclicReference(new HashSet <ITypeParameter> () { tp }, outerType, ((DomReturnType)rt).DecoratedFullName)) { continue; } IType bt = dom.SearchType(typeParameterMember, rt); IReturnType resolvedType = rt; if (bt != null) { resolvedType = new DomReturnType(bt); if (bt.ClassType == ClassType.Interface || BaseType != null) { AddInterfaceImplementation(resolvedType); } else { ClassType = bt.ClassType; BaseType = resolvedType; } } else { AddInterfaceImplementation(resolvedType); } } if (BaseType == null) { BaseType = DomReturnType.Object; } }
IType FindGenericParameter(ICompilationUnit cu, ITypeParameterMember callingClass, string name) { foreach (TypeParameter tp in callingClass.TypeParameters) { if (tp.Name == name) { return(CreateInstantiatedParameterType(callingClass, tp)); } } if (callingClass.DeclaringType != null) { return(FindGenericParameter(cu, callingClass.DeclaringType, name)); } return(null); }
public virtual void TranslateMember(ITypeParameterMember typeParamMember) { if (typeParamMember is IMethodSignatureTypeParameterMember) { this.TranslateMember((IMethodSignatureTypeParameterMember)typeParamMember); } else if (typeParamMember is IMethodTypeParameterMember) { this.TranslateMember((IMethodTypeParameterMember)typeParamMember); } else if (typeParamMember is ITypeParameterMember <CodeTypeDelegate> ) { this.TranslateMember((ITypeParameterMember <CodeTypeDelegate>)typeParamMember); } else if (typeParamMember is ITypeParameterMember <CodeTypeDeclaration> ) { this.TranslateMember((ITypeParameterMember <CodeTypeDeclaration>)typeParamMember); } }
public void TranslateConstraints(ITypeParameterMember typeParamMember) { if (typeParamMember is IMethodSignatureTypeParameterMember) { this.TranslateConstraints((IMethodSignatureTypeParameterMember)typeParamMember); } else if (typeParamMember is IMethodTypeParameterMember) { this.TranslateConstraints((IMethodTypeParameterMember)typeParamMember); } else if (typeParamMember is ITypeParameterMember <CodeTypeDelegate> ) { this.TranslateConstraints <CodeTypeParameter, IDeclaredType <CodeTypeDelegate> >((ITypeParameterMember <CodeTypeDelegate>)typeParamMember); } else if (typeParamMember is ITypeParameterMember <CodeTypeDeclaration> ) { this.TranslateConstraints((ITypeParameterMember <CodeTypeDeclaration>)typeParamMember); } else { throw new NotSupportedException("Unknown type-parameter."); } }
public override IType CreateInstantiatedParameterType (ITypeParameterMember typeParameterMember, TypeParameter tp) { return decorated.CreateInstantiatedParameterType (typeParameterMember, tp); }
public abstract void TranslateConstraints <TDom, TParent>(ITypeParameterMember <TDom, TParent> ambigTypeParamMember) where TDom : CodeTypeParameter, new() where TParent : IDeclaration;
public virtual void TranslateConstraints(ITypeParameterMember <CodeTypeDeclaration> ambigTypeParameter) { TranslateConstraints <CodeTypeParameter, IDeclaredType <CodeTypeDeclaration> >(ambigTypeParameter); }
public override void TranslateConceptTypeName(ITypeParameterMember type, ITypeReferenceCollection typeParameters) { this.Provider.GenerateCodeFromExpression(type.GetTypeReference(typeParameters).GetTypeExpression().GenerateCodeDom(this.Options), base.Target, this.Options.Options); }
public abstract void TranslateConceptTypeName(ITypeParameterMember type, ITypeReferenceCollection typeParameters);
public virtual IType CreateInstantiatedParameterType(ITypeParameterMember typeParameterMember, TypeParameter tp) { return(new InstantiatedParameterType(this, typeParameterMember, tp)); }
public override IType CreateInstantiatedParameterType(ITypeParameterMember typeParameterMember, TypeParameter tp) { return(decorated.CreateInstantiatedParameterType(typeParameterMember, tp)); }
public override void TranslateConstraints <TDom, TParent>(ITypeParameterMember <TDom, TParent> ambigTypeParamMember) { throw new NotSupportedException("The method or operation is not supported."); }
IType FindGenericParameter (ICompilationUnit cu, ITypeParameterMember callingClass, string name) { foreach (TypeParameter tp in callingClass.TypeParameters) { if (tp.Name == name) return CreateInstantiatedParameterType (callingClass, tp); } if (callingClass.DeclaringType != null) return FindGenericParameter (cu, callingClass.DeclaringType, name); return null; }
public virtual IType CreateInstantiatedParameterType (ITypeParameterMember typeParameterMember, TypeParameter tp) { return new InstantiatedParameterType (this, typeParameterMember, tp); }
public override void TranslateMember <TDom, TParent>(ITypeParameterMember <TDom, TParent> typeParamMember) { Target.Write(typeParamMember.Name); }