fix #1639
This commit is contained in:
parent
0128947792
commit
2e2e537e37
|
|
@ -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 = "2184";
|
||||
public const string Revision = "2188";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%COREVERSION%=0
|
||||
%REVISION%=2184
|
||||
%REVISION%=2188
|
||||
%MINOR%=5
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.5.0.2184'
|
||||
!define VERSION '3.5.0.2188'
|
||||
|
|
|
|||
|
|
@ -150,15 +150,16 @@ namespace SyntaxVisitors
|
|||
var stels = seqt.elements_type;
|
||||
|
||||
var iteratorClassName = GetClassName(pd);
|
||||
/*var classDef = UpperNode(3) as class_definition;
|
||||
|
||||
var staticClass = false;
|
||||
if ((classDef.attribute & class_attribute.Static) != 0)
|
||||
/*var staticClass = false;
|
||||
|
||||
var classDef = GetMethodClassDefinition(pd);
|
||||
|
||||
if (classDef != null && (classDef.attribute & class_attribute.Static) != 0)
|
||||
staticClass = true;*/
|
||||
|
||||
|
||||
// frninja 08/18/15 - Для захвата self
|
||||
if (iteratorClassName != null/* && !staticClass */)
|
||||
if (iteratorClassName != null /*&& !staticClass*/)
|
||||
{
|
||||
// frninja 20/04/16 - поддержка шаблонных классов
|
||||
var iteratorClassRef = CreateClassReference(iteratorClassName);
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ namespace SyntaxVisitors
|
|||
CapturedFormalParamsMap = new Dictionary<string, string>(formalParamsMap);
|
||||
|
||||
IsInClassMethod = isInClassMethod;
|
||||
IsStaticMethod = isStaticMethod;
|
||||
ClassName = className;
|
||||
|
||||
// Methods hack
|
||||
|
|
@ -112,6 +113,7 @@ namespace SyntaxVisitors
|
|||
|
||||
|
||||
//var capturedId = new dot_node(new dot_node(new ident("self"), new ident(YieldConsts.Self)), id);
|
||||
//var capturedId = new dot_node(ClassName, id.TypedClone());
|
||||
//Replace(id, capturedId);
|
||||
}
|
||||
//else
|
||||
|
|
|
|||
14
TestSuite/Yield_static_1.pas
Normal file
14
TestSuite/Yield_static_1.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
type
|
||||
T = static class
|
||||
static r: integer := 3;
|
||||
static property p: integer read 1;
|
||||
static function r1(i: integer): integer := 2;
|
||||
public static function f(a: integer): sequence of integer;
|
||||
begin
|
||||
yield r + a + p +r1(1);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
Assert(T.f(5).First=11);
|
||||
end.
|
||||
14
TestSuite/Yield_static_2.pas
Normal file
14
TestSuite/Yield_static_2.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
type
|
||||
T = {static} class
|
||||
static r: integer := 3;
|
||||
static property p: integer read 1;
|
||||
static function r1(i: integer): integer := 2;
|
||||
public static function f(a: integer): sequence of integer;
|
||||
begin
|
||||
yield r + a + p +r1(1);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
Assert(T.f(5).First=11);
|
||||
end.
|
||||
16
TestSuite/Yield_static_3.pas
Normal file
16
TestSuite/Yield_static_3.pas
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
type
|
||||
T = {static} class
|
||||
static r: integer := 3;
|
||||
static property p: integer read 1;
|
||||
static function r1(i: integer): integer := 2;
|
||||
public static function f(a: integer): sequence of integer;
|
||||
end;
|
||||
|
||||
static function T.f(a: integer): sequence of integer;
|
||||
begin
|
||||
yield r + a + p +r1(1);
|
||||
end;
|
||||
|
||||
begin
|
||||
Assert(T.f(5).First=11);
|
||||
end.
|
||||
16
TestSuite/Yield_static_4.pas
Normal file
16
TestSuite/Yield_static_4.pas
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
type
|
||||
T = static class
|
||||
static r: integer := 3;
|
||||
static property p: integer read 1;
|
||||
static function r1(i: integer): integer := 2;
|
||||
public static function f(a: integer): sequence of integer;
|
||||
end;
|
||||
|
||||
static function T.f(a: integer): sequence of integer;
|
||||
begin
|
||||
yield r + a + p +r1(1);
|
||||
end;
|
||||
|
||||
begin
|
||||
Assert(T.f(5).First=11);
|
||||
end.
|
||||
|
|
@ -16148,7 +16148,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
tn = convert_strong(_var_def_statement.vars_type);
|
||||
//LambdaHelper.InferTypesFromVarStmt(tn, _var_def_statement.inital_value as SyntaxTree.function_lambda_definition, this); //lroman//
|
||||
if (tn.IsStatic)
|
||||
if (tn.IsStatic && _var_def_statement.vars.idents[0].name != YieldHelpers.YieldConsts.Self) // SSM 10/07/19 fix #1639 в статическом классе можно только фиктивное поле с именем YieldHelpers.YieldConsts.Self описать - для того чтобы посмотреть на семантике его тип!!!
|
||||
AddError(get_location(_var_def_statement), "VARIABLES_OF_STATIC_CLASS_NOT_ALLOWED");
|
||||
var fld1 = _var_def_statement.inital_value as SyntaxTree.function_lambda_definition;
|
||||
if (fld1 != null)
|
||||
|
|
@ -20098,7 +20098,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
// Search for unknown ident in class
|
||||
var found = iteratorContainingClass.find(_unk.UnknownID.name);
|
||||
if ((object)found != null)
|
||||
if (found != null)
|
||||
{
|
||||
// class_field - поле класса
|
||||
// common_method_node - метод класса
|
||||
|
|
|
|||
Loading…
Reference in a new issue