コード例 #1
0
ファイル: RigidTypeException.cs プロジェクト: minib00m/JNP2
        internal static RigidTypeException Create(string name, Type type)
        {
            var sb  = new StringBuilder();
            var tpp = new TypePrettyPrinter();

            type.PrettyPrint(tpp, sb, 0);
            return(new RigidTypeException(name, sb.ToString(), tpp));
        }
コード例 #2
0
        internal static OccursCheckException Create(Type lhs, Type rhs)
        {
            var sb1 = new StringBuilder();
            var sb2 = new StringBuilder();
            var tpp = new TypePrettyPrinter();

            lhs.PrettyPrint(tpp, sb1, 0);
            rhs.PrettyPrint(tpp, sb2, 0);
            return(new OccursCheckException(sb1.ToString(), sb2.ToString(), tpp));
        }
コード例 #3
0
ファイル: TypeScheme.cs プロジェクト: minib00m/JNP2
 public override void PrettyPrint(TypePrettyPrinter typePrettyPrinter, StringBuilder stringBuilder, int level)
 {
     stringBuilder.Append("forall");
     foreach (var variable in Arguments)
     {
         stringBuilder.Append(" " + typePrettyPrinter[variable]);
     }
     stringBuilder.Append(". ");
     Inner.PrettyPrint(typePrettyPrinter, stringBuilder, 1);
 }
コード例 #4
0
ファイル: FunctionType.cs プロジェクト: minib00m/JNP2
 public override void PrettyPrint(TypePrettyPrinter typePrettyPrinter, StringBuilder stringBuilder, int level)
 {
     if (level > 2)
     {
         stringBuilder.Append('(');
     }
     Argument.PrettyPrint(typePrettyPrinter, stringBuilder, 3);
     stringBuilder.Append(" -> ");
     Result.PrettyPrint(typePrettyPrinter, stringBuilder, 2);
     if (level > 2)
     {
         stringBuilder.Append(')');
     }
 }
コード例 #5
0
 public void Unify(Type that, Substitution substitution)
 {
     try
     {
         Perform(substitution).SubstUnify(that.Perform(substitution), substitution);
     }
     catch (StackedException ex)
     {
         var sb = new StringBuilder("While trying to unify ");
         PrettyPrint(ex.PrettyPrinter, sb, 0);
         sb.Append(" with ");
         that.PrettyPrint(ex.PrettyPrinter, sb, 0);
         ex.Push(sb.ToString());
         throw;
     }
 }