protected void TypeIdentifier(TypeReference type, TypeReferenceContext context, bool includeParens) { if (type.FullName == "JSIL.Proxy.AnyType") { WriteRaw("JSIL.AnyType"); return; } if (TypeUtil.TypesAreEqual(context.EnclosingType, type, true)) { WriteRaw("$thisType"); return; } if (type.IsGenericParameter) { var gp = (GenericParameter)type; var ownerType = gp.Owner as TypeReference; if (gp.Owner == null) { Value(gp.Name); } else if ( (CurrentMethod != null) && ((CurrentMethod.Equals(gp.Owner)) || (CurrentMethod.DeclaringType.Equals(gp.Owner)) ) ) { if (ownerType != null) { Identifier(ownerType, context); Dot(); Identifier(gp.Name); Dot(); Identifier("get"); LPar(); WriteRaw("this"); RPar(); } else { Identifier(gp.Name); } } else { if (EmitThisForParameter(gp)) { WriteRaw("this"); Dot(); } Identifier(type.FullName); } } else { var info = TypeInfo.Get(type); if ((info != null) && (info.Replacement != null)) { WriteRaw(info.Replacement); return; } var typedef = type.Resolve(); if (typedef != null) { if (GetContainingAssemblyName(typedef) == Assembly.FullName) { WriteToken(PrivateToken); WriteRaw("."); } else { AssemblyReference(typedef); WriteRaw("."); } } if (info != null) { WriteRaw(Util.EscapeIdentifier( info.FullName, EscapingMode.TypeIdentifier )); } else { // FIXME: Is this right? WriteRaw(Util.EscapeIdentifier( type.FullName, EscapingMode.TypeIdentifier )); } } }