Мелкие дописки для prettyPrinterа

This commit is contained in:
Mikhalkovich Stanislav 2020-06-12 12:29:52 +03:00
parent 6226fa7d41
commit 8621cb39f2
7 changed files with 32 additions and 9 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "6";
public const string Build = "3";
public const string Revision = "2497";
public const string Revision = "2498";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%MINOR%=6
%REVISION%=2497
%COREVERSION%=3
%REVISION%=2498
%MINOR%=6
%MAJOR%=3

View file

@ -1 +1 @@
3.6.3.2497
3.6.3.2498

View file

@ -1 +1 @@
!define VERSION '3.6.3.2497'
!define VERSION '3.6.3.2498'

View file

@ -1965,6 +1965,16 @@ namespace PascalABCCompiler.SyntaxTree
{
public override string ToString() => "<proc_type>";
}
public partial class ident_with_templateparams
{
public override string ToString() => $"{this.name}{this.template_params}";
}
public partial class template_param_list
{
public override string ToString() => "<"+string.Join(",",this.params_list.Select(td=>td.ToString()))+">";
}
/*
public partial class slice_expr : dereference
{

View file

@ -1,6 +1,7 @@
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Linq;
using System.Collections.Generic;
namespace PascalABCCompiler.TreeRealization
@ -66,7 +67,14 @@ namespace PascalABCCompiler.TreeRealization
public override string ToString()
{
System.Text.StringBuilder str = new System.Text.StringBuilder();
str.Append((return_value_type != null ? "function " : "procedure ") + name + "(");
str.Append((return_value_type != null ? "function " : "procedure ") + name);
if (this is common_function_node cfn && cfn.generic_parameters_count > 0)
{
str.Append("<");
str.Append(string.Join(",", cfn.generic_params.Select(tn => tn.name)));
str.Append(">");
}
str.Append("(");
foreach (var par in parameters)
str.Append(par.ToString() + ";");
str.Append(")");

View file

@ -459,7 +459,7 @@ namespace PascalABCCompiler.TreeRealization
{
if (comm_type.is_generic_parameter)
{
if (method_param_types && comm_type.generic_function_container != null)
if (method_param_types && comm_type.generic_function_container != null)
{
return param_types[comm_type.generic_param_index];
}
@ -1573,11 +1573,16 @@ namespace PascalABCCompiler.TreeRealization
}
}
cmn.parameters.AddRange(make_parameters(orig_fn.parameters, cmn));
if (orig_fn.is_generic_function)
if (orig_fn.is_generic_function) // orig_fn м.б. generic-методом, но и класс м.б.generic!!! Смешение параметров! А у нас либо класс, либо функция
{
foreach (common_parameter cp in cmn.parameters)
{
cp.type = generic_convertions.determine_type(cp.type, meth_inst_pars, true);
//if (cp.type.PrintableName == "Action<TSource>" || cp.type.PrintableName == "TSource") { } // ничего не надо делать, поскольку
//cp.type = generic_convertions.determine_type(cp.type, _instance_params, false);
//else
// Action<T,T2> - T м.б. от класса, а T2 - от метода! И надо передавать оба: meth_inst_pars и _instance_params
// И индексом м.б. не обойдёшься
cp.type = generic_convertions.determine_type(cp.type, meth_inst_pars, true);
}
}
common_method_node common_orig = orig_fn as common_method_node;