public static TypeCompilerEnvironment EnterType
            (CompilerEnvironment env,
            JST.NameSupply nameSupply,
            JST.Identifier rootId,
            JST.Identifier assemblyId,
            JST.Identifier typeId,
            CST.TypeEnvironment typeEnv,
            TypeTrace typeTrace)
        {
            var typeBoundTypeParameterIds = new Seq <JST.Identifier>();

            for (var i = 0; i < typeEnv.Type.Arity; i++)
            {
                typeBoundTypeParameterIds.Add(nameSupply.GenSym());
            }

            var res = new TypeCompilerEnvironment
                          (typeEnv.Global,
                          typeEnv.SkolemDefs,
                          typeEnv.Assembly,
                          typeEnv.Type,
                          typeEnv.TypeBoundArguments,
                          env,
                          nameSupply,
                          rootId,
                          assemblyId,
                          typeId,
                          typeBoundTypeParameterIds,
                          typeTrace);

            res.BindSpecial();

            return(res);
        }
 private void BindBaseTypes(CST.TypeEnvironment thisTypeEnv, JST.Expression thisType)
 {
     if (thisTypeEnv.Type.Extends != null)
     {
         var baseTypeEnv = thisTypeEnv.Type.Extends.Enter(thisTypeEnv);
         var baseType    = JST.Expression.Dot(thisType, Constants.TypeBaseType);
         if (!boundTypes.ContainsKey(baseTypeEnv.TypeRef))
         {
             boundTypes.Add(baseTypeEnv.TypeRef, new ExpressionAndPhase(baseType, TypePhase.Slots));
         }
         if (baseTypeEnv.Type.Arity > 0)
         {
             if (!boundTypes.ContainsKey(baseTypeEnv.TypeConstructorRef))
             {
                 boundTypes.Add(baseTypeEnv.TypeConstructorRef, new ExpressionAndPhase(JST.Expression.Dot(baseType, Constants.TypeApplicand), TypePhase.Slots));
             }
         }
         BindBaseTypes(baseTypeEnv, baseType);
     }
 }