// Initializes a substitution context. Returns false iff no substitutions will ever be performed. private void Init(TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { if (typeArgsCls != null) { #if DEBUG typeArgsCls.AssertValid(); #endif ctypeCls = typeArgsCls.size; prgtypeCls = typeArgsCls.ToArray(); } else { ctypeCls = 0; prgtypeCls = null; } if (typeArgsMeth != null) { #if DEBUG typeArgsMeth.AssertValid(); #endif ctypeMeth = typeArgsMeth.size; prgtypeMeth = typeArgsMeth.ToArray(); } else { ctypeMeth = 0; prgtypeMeth = null; } this.grfst = grfst; }
// Initializes a substitution context. Returns false iff no substitutions will ever be performed. public void Init(TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { if (typeArgsCls != null) { #if DEBUG typeArgsCls.AssertValid(); #endif ctypeCls = typeArgsCls.size; prgtypeCls = typeArgsCls.ToArray(); } else { ctypeCls = 0; prgtypeCls = null; } if (typeArgsMeth != null) { #if DEBUG typeArgsMeth.AssertValid(); #endif ctypeMeth = typeArgsMeth.size; prgtypeMeth = typeArgsMeth.ToArray(); } else { ctypeMeth = 0; prgtypeMeth = null; } this.grfst = grfst; }
// Initializes a substitution context. Returns false iff no substitutions will ever be performed. private void Init(TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { if (typeArgsCls != null) { typeArgsCls.AssertValid(); ctypeCls = typeArgsCls.Count; prgtypeCls = typeArgsCls.Items; } else { ctypeCls = 0; prgtypeCls = null; } if (typeArgsMeth != null) { typeArgsMeth.AssertValid(); ctypeMeth = typeArgsMeth.Count; prgtypeMeth = typeArgsMeth.Items; } else { ctypeMeth = 0; prgtypeMeth = null; } this.grfst = grfst; }
public SubstContext(CType[] prgtypeCls, int ctypeCls, CType[] prgtypeMeth, int ctypeMeth, SubstTypeFlags grfst) { this.prgtypeCls = prgtypeCls; this.ctypeCls = ctypeCls; this.prgtypeMeth = prgtypeMeth; this.ctypeMeth = ctypeMeth; this.grfst = grfst; }
private SubstContext(CType[] prgtypeCls, int ctypeCls, CType[] prgtypeMeth, int ctypeMeth, SubstTypeFlags grfst) { this.prgtypeCls = prgtypeCls; this.ctypeCls = ctypeCls; this.prgtypeMeth = prgtypeMeth; this.ctypeMeth = ctypeMeth; this.grfst = grfst; }
private SubstContext(AggregateType type, TypeArray typeArgsMeth, SubstTypeFlags grfst) { Init(type?.GetTypeArgsAll(), typeArgsMeth, grfst); }
public SubstContext(TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { Init(typeArgsCls, typeArgsMeth, grfst); }
public SubstContext(AggregateType type, TypeArray typeArgsMeth, SubstTypeFlags grfst) { Init(type != null ? type.GetTypeArgsAll() : null, typeArgsMeth, grfst); }
public bool SubstEqualTypeArrays(TypeArray taDst, TypeArray taSrc, TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { // Handle the simple common cases first. if (taDst == taSrc || (taDst != null && taDst.Equals(taSrc))) { // The following assertion is not always true and indicates a problem where // the signature of override method does not match the one inherited from // the base class. The method match we have found does not take the type // arguments of the base class into account. So actually we are not overriding // the method that we "intend" to. // Debug.Assert(taDst == SubstTypeArray(taSrc, typeArgsCls, typeArgsMeth, grfst)); return(true); } if (taDst.Count != taSrc.Count) { return(false); } if (taDst.Count == 0) { return(true); } var ctx = new SubstContext(typeArgsCls, typeArgsMeth, grfst); if (ctx.FNop()) { return(false); } for (int i = 0; i < taDst.Count; i++) { if (!SubstEqualTypesCore(taDst[i], taSrc[i], ctx)) { return(false); } } return(true); }
public bool SubstEqualTypes(CType typeDst, CType typeSrc, TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { if (typeDst.Equals(typeSrc)) { Debug.Assert(typeDst.Equals(SubstType(typeSrc, typeArgsCls, typeArgsMeth, grfst))); return(true); } var ctx = new SubstContext(typeArgsCls, typeArgsMeth, grfst); return(!ctx.FNop() && SubstEqualTypesCore(typeDst, typeSrc, ctx)); }
private CType SubstType(CType typeSrc, TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { if (typeSrc == null) { return(null); } var ctx = new SubstContext(typeArgsCls, typeArgsMeth, grfst); return(ctx.FNop() ? typeSrc : SubstTypeCore(typeSrc, ctx)); }
public bool SubstEqualTypeArrays(TypeArray taDst, TypeArray taSrc, TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { // Handle the simple common cases first. if (taDst == taSrc || (taDst != null && taDst.Equals(taSrc))) { // The following assertion is not always true and indicates a problem where // the signature of override method does not match the one inherited from // the base class. The method match we have found does not take the type // arguments of the base class into account. So actually we are not overriding // the method that we "intend" to. // Debug.Assert(taDst == SubstTypeArray(taSrc, typeArgsCls, typeArgsMeth, grfst)); return true; } if (taDst.Size != taSrc.Size) return false; if (taDst.Size == 0) return true; var ctx = new SubstContext(typeArgsCls, typeArgsMeth, grfst); if (ctx.FNop()) return false; for (int i = 0; i < taDst.size; i++) { if (!SubstEqualTypesCore(taDst.Item(i), taSrc.Item(i), ctx)) return false; } return true; }
public bool SubstEqualTypes(CType typeDst, CType typeSrc, TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { if (typeDst.Equals(typeSrc)) { Debug.Assert(typeDst.Equals(SubstType(typeSrc, typeArgsCls, typeArgsMeth, grfst))); return true; } var ctx = new SubstContext(typeArgsCls, typeArgsMeth, grfst); return !ctx.FNop() && SubstEqualTypesCore(typeDst, typeSrc, ctx); }
public TypeArray SubstTypeArray(TypeArray taSrc, TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { if (taSrc == null || taSrc.Size == 0) return taSrc; var ctx = new SubstContext(typeArgsCls, typeArgsMeth, grfst); if (ctx.FNop()) return taSrc; CType[] prgpts = new CType[taSrc.Size]; for (int ipts = 0; ipts < taSrc.Size; ipts++) { prgpts[ipts] = SubstTypeCore(taSrc.Item(ipts), ctx); } return _BSymmgr.AllocParams(taSrc.Size, prgpts); }
public CType SubstType(CType typeSrc, TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { if (typeSrc == null) return null; var ctx = new SubstContext(typeArgsCls, typeArgsMeth, grfst); return ctx.FNop() ? typeSrc : SubstTypeCore(typeSrc, ctx); }
private TypeArray SubstTypeArray(TypeArray taSrc, TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { if (taSrc == null || taSrc.Count == 0) { return(taSrc); } var ctx = new SubstContext(typeArgsCls, typeArgsMeth, grfst); if (ctx.FNop()) { return(taSrc); } CType[] prgpts = new CType[taSrc.Count]; for (int ipts = 0; ipts < taSrc.Count; ipts++) { prgpts[ipts] = SubstTypeCore(taSrc[ipts], ctx); } return(_BSymmgr.AllocParams(taSrc.Count, prgpts)); }