This commit is contained in:
Mikhalkovich Stanislav 2019-06-21 08:24:10 +03:00
parent 8c64a4d03f
commit b2f42cca9c
10 changed files with 135 additions and 15 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "5";
public const string Build = "0";
public const string Revision = "2118";
public const string Revision = "2129";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%COREVERSION%=0
%REVISION%=2118
%MINOR%=5
%REVISION%=2129
%COREVERSION%=0
%MAJOR%=3

View file

@ -1 +1 @@
!define VERSION '3.5.0.2118'
!define VERSION '3.5.0.2129'

View file

@ -0,0 +1,19 @@
type
t0<T> = class end;
t1<T> = class(t0<T>)
//fld: integer;
public procedure p1();
begin
var b: integer;
var bw: T;
var p: procedure := ()->
begin
var b1 := b;
var b2 := b;
//var f := fld;
end;
end;
end;
begin
end.

View file

@ -0,0 +1,19 @@
type
t0<T> = class end;
t1<T> = class(t0<T>)
//fld: integer;
public procedure p1();
var b: integer;
begin
var bw: T;
var p: procedure := ()->
begin
var b1 := b;
var b2 := b;
//var f := fld;
end;
end;
end;
begin
end.

View file

@ -0,0 +1,18 @@
type
t0<T> = class end;
t1<T> = class(t0<T>)
//fld: integer;
public procedure p1(b: integer);
begin
var bw: T;
var p: procedure := ()->
begin
var b1 := b;
var b2 := b;
//var f := fld;
end;
end;
end;
begin
end.

View file

@ -0,0 +1,19 @@
type
t0<T> = class end;
t1<T> = class(t0<T>)
//fld: integer;
public procedure p1();
var b: T;
begin
var bw: T;
var p: procedure := ()->
begin
var b1 := b;
var b2 := b;
//var f := fld;
end;
end;
end;
begin
end.

View file

@ -0,0 +1,19 @@
type
t0<T> = class end;
t1<T> = class(t0<T>)
//fld: integer;
public procedure p1();
var b: T;
begin
var bw: T;
var p: procedure := ()->
begin
var b1 := b;
var b2 := b;
//var f := fld;
end;
end;
end;
begin
end.

View file

@ -150,6 +150,7 @@ namespace TreeConverter.LambdaExpressions.Closure
var idName = id.name.ToLower();
SymbolInfo si = _visitor.context.find_first(idName);
//var q = si.GetHashCode();
if (si == null)
{
@ -203,7 +204,7 @@ namespace TreeConverter.LambdaExpressions.Closure
{
var classIdent = new ident(classNode.name.Remove(classNode.name.IndexOf("<")));
var templateParams = new template_param_list(classNode.instance_params.Select(x => x.name).Aggregate("", (acc, elem) => acc += elem));
return new ident_with_templateparams(classIdent, templateParams);
return new ident_with_templateparams(classIdent, templateParams);
}
else
{
@ -342,12 +343,22 @@ namespace TreeConverter.LambdaExpressions.Closure
}
else
{
var field = prScope.VariablesDefinedInScope.Find(var => var.SymbolInfo == si);
var field = prScope.VariablesDefinedInScope.Find(var => var.SymbolInfo == si);
if (field == null)
if (field == null) // если не было такого
{
prScope.VariablesDefinedInScope.Add(new CapturedVariablesTreeNode.CapturedSymbolInfo(null,
si));
// local_block_variable common_parameter - в процедуре могут быть только эти
var found = false;
foreach (var v in prScope.VariablesDefinedInScope) // и не было с таким же именем
{
if (v.SymbolInfo.sym_info is var_definition_node vdn && vdn.name.ToLower() == id.name.ToLower()) // SSM попытка бороться с #2001 - исключаю одноимённые
{
found = true;
break;
}
}
if (!found) // то добавить
prScope.VariablesDefinedInScope.Add(new CapturedVariablesTreeNode.CapturedSymbolInfo(null, si)); // это было
}
}
}
@ -375,14 +386,29 @@ namespace TreeConverter.LambdaExpressions.Closure
}
}
var idRef = (selfWordInClass ? _classScope : scope)
.VariablesDefinedInScope
.Find(var => var.SymbolInfo == si);
var sc = selfWordInClass ? _classScope : scope;
var idRef = sc.VariablesDefinedInScope.Find(var => var.SymbolInfo == si);
if (idRef == null) //TODO: Осторожнее переделать
{
{
return;
/*var index = -1;
for (var i=0; i < sc.VariablesDefinedInScope.Count; i++)
{
if (sc.VariablesDefinedInScope[i].SymbolInfo.sym_info is var_definition_node vdn && vdn.name.ToLower() == id.name.ToLower()) // SSM #2001 и подобные - исключаю одноимённые
{
index = i;
break;
}
}
if (index == -1) // то добавить
{
sc.VariablesDefinedInScope.Add(new CapturedVariablesTreeNode.CapturedSymbolInfo(null, si));
index = sc.VariablesDefinedInScope.Count - 1;
}
idRef = sc.VariablesDefinedInScope[index];*/
return; // SSM 21/06/19 - так было
}
}

View file

@ -1869,10 +1869,10 @@ namespace PascalABCCompiler.TreeRealization
{
foreach (SymbolInfo si in start)
{
// aab 13.06.19 begin
// Бурмистров Артем 13.06.19 begin
// Поправил странное поведение для локальных переменных, у которых не generic тип
// Исправление для #1993
if (si.sym_info is local_block_variable variable && !variable.type.is_generic_parameter)
if (si.sym_info is /*var_definition_node*/ local_block_variable vdn && !vdn.type.is_generic_parameter)
{
rez_si = si;
}