bug fix #2211
This commit is contained in:
parent
d7e43e8e7b
commit
39ade48ce6
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "6";
|
||||
public const string Build = "2";
|
||||
public const string Revision = "2374";
|
||||
public const string Revision = "2376";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%COREVERSION%=2
|
||||
%REVISION%=2374
|
||||
%REVISION%=2376
|
||||
%MINOR%=6
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,7 +2,7 @@
|
|||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: DESKTOP-G8V08V4
|
||||
// DateTime: 07.03.2020 10:31:43
|
||||
// DateTime: 08.03.2020 11:15:34
|
||||
// UserName: ?????????
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
|
|
|
|||
|
|
@ -1550,15 +1550,6 @@ object_type
|
|||
{
|
||||
var cd = NewObjectType((class_attribute)$1, $2, $3 as named_type_reference_list, $4 as where_definition_list, $5 as class_body_list, @$);
|
||||
$$ = cd;
|
||||
/*var tt = cd.DescendantNodes().OfType<class_definition>().Where(cld => cld.keyword == class_keyword.Record);
|
||||
if (tt.Count()>0)
|
||||
{
|
||||
foreach (var ttt in tt)
|
||||
{
|
||||
var sc = ttt.source_context;
|
||||
parsertools.AddErrorFromResource("NESTED_RECORD_DEFINITIONS_ARE_FORBIDDEN", new LexLocation(sc.begin_position.line_num, sc.begin_position.column_num-1, sc.end_position.line_num, sc.end_position.column_num, sc.FileName));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// GPPG version 1.3.6
|
||||
// Machine: DESKTOP-G8V08V4
|
||||
// DateTime: 07.03.2020 10:31:44
|
||||
// DateTime: 08.03.2020 11:15:35
|
||||
// UserName: ?????????
|
||||
// Input file <ABCPascal.y>
|
||||
|
||||
|
|
@ -3973,15 +3973,6 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
|
|||
{
|
||||
var cd = NewObjectType((class_attribute)ValueStack[ValueStack.Depth-5].ob, ValueStack[ValueStack.Depth-4].ti, ValueStack[ValueStack.Depth-3].stn as named_type_reference_list, ValueStack[ValueStack.Depth-2].stn as where_definition_list, ValueStack[ValueStack.Depth-1].stn as class_body_list, CurrentLocationSpan);
|
||||
CurrentSemanticValue.td = cd;
|
||||
/*var tt = cd.DescendantNodes().OfType<class_definition>().Where(cld => cld.keyword == class_keyword.Record);
|
||||
if (tt.Count()>0)
|
||||
{
|
||||
foreach (var ttt in tt)
|
||||
{
|
||||
var sc = ttt.source_context;
|
||||
parsertools.AddErrorFromResource("NESTED_RECORD_DEFINITIONS_ARE_FORBIDDEN", new LexLocation(sc.begin_position.line_num, sc.begin_position.column_num-1, sc.end_position.line_num, sc.end_position.column_num, sc.FileName));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
break;
|
||||
case 284: // record_type -> tkRecord, optional_base_classes, optional_where_section,
|
||||
|
|
|
|||
|
|
@ -263,5 +263,6 @@ script=
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
3.6.2.2374
|
||||
3.6.2.2376
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.6.2.2374'
|
||||
!define VERSION '3.6.2.2376'
|
||||
|
|
|
|||
|
|
@ -12,6 +12,27 @@ using PascalABCCompiler.Errors;
|
|||
|
||||
namespace SyntaxVisitors
|
||||
{
|
||||
public class CheckArrayRecordInitializersVisitor : WalkingVisitorNew
|
||||
{
|
||||
//procedure_definition PD;
|
||||
public static CheckArrayRecordInitializersVisitor New
|
||||
{
|
||||
get { return new CheckArrayRecordInitializersVisitor(); }
|
||||
}
|
||||
public override void visit(function_lambda_definition ld)
|
||||
{
|
||||
// пропустить всё
|
||||
}
|
||||
public override void visit(var_def_statement vd)
|
||||
{
|
||||
if (vd.inital_value is array_const)
|
||||
throw new SyntaxVisitorError("FUNCTION_WITH_YIELD_CANNOT_CONTAIN_OLDSTYLE_ARRAY_INITIALIZERS", vd.inital_value.source_context);
|
||||
if (vd.inital_value is record_const)
|
||||
throw new SyntaxVisitorError("FUNCTION_WITH_YIELD_CANNOT_CONTAIN_OLDSTYLE_RECORD_INITIALIZERS", vd.inital_value.source_context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class MarkMethodHasYieldAndCheckSomeErrorsVisitor : WalkingVisitorNew
|
||||
{
|
||||
private bool HasYields = false;
|
||||
|
|
@ -75,6 +96,8 @@ namespace SyntaxVisitors
|
|||
throw new SyntaxVisitorError("FUNCTIONS_WITH_YIELDS_CANNOT_CONTAIN_INHERITED_CALLS", FirstInheritedIdent.First().source_context);
|
||||
}
|
||||
}
|
||||
|
||||
CheckArrayRecordInitializersVisitor.New.ProcessNode(pd);
|
||||
}
|
||||
|
||||
/*if (pd.has_yield)
|
||||
|
|
|
|||
|
|
@ -2595,6 +2595,11 @@ type
|
|||
constructor (c: string; n, w: integer; f: string) := (Comment, Num, Width, Fmt) := (c, n, w, f);
|
||||
end;
|
||||
|
||||
type
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
PCUNotRestoreAttribute = class(System.Attribute)
|
||||
public constructor := exit;
|
||||
end;
|
||||
|
||||
///--
|
||||
function InternalRange(l,r: integer): IntRange;
|
||||
|
|
|
|||
14
TestSuite/errors/err0353_arr_rec_init_in_yield.pas
Normal file
14
TestSuite/errors/err0353_arr_rec_init_in_yield.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
type Rec = record
|
||||
i: integer;
|
||||
end;
|
||||
|
||||
function f1: sequence of word;
|
||||
begin
|
||||
//var r: Rec := (i: 2);
|
||||
var a: array of array of integer := ((1,2),(3));
|
||||
yield 0;
|
||||
end;
|
||||
|
||||
begin
|
||||
|
||||
end.
|
||||
14
TestSuite/errors/err0354_arr_rec_init_in_yield.pas
Normal file
14
TestSuite/errors/err0354_arr_rec_init_in_yield.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
type Rec = record
|
||||
i: integer;
|
||||
end;
|
||||
|
||||
function f1: sequence of word;
|
||||
begin
|
||||
var r: Rec := (i: 2);
|
||||
//var a: array of array of integer := ((1,2),(3));
|
||||
yield 0;
|
||||
end;
|
||||
|
||||
begin
|
||||
|
||||
end.
|
||||
|
|
@ -12,6 +12,8 @@ FUNCTIONS_WITH_YIELDS_CANNOT_CONTAIN_TRY_EXCEPT_FINALLY=Functions with yield can
|
|||
FUNCTIONS_WITH_YIELDS_CANNOT_CONTAIN_NESTED_SUBROUTINES=Functions with yield cannot contain nested subrotines or be nested
|
||||
FUNCTIONS_WITH_YIELDS_CANNOT_CONTAIN_LOCAL_TYPE_DEFINITIONS=Functions with yield cannot contain local type definitions
|
||||
FUNCTIONS_WITH_YIELDS_CANNOT_CONTAIN_INHERITED_CALLS=Functions with yield cannot contain calls of inherited methods
|
||||
FUNCTION_WITH_YIELD_CANNOT_CONTAIN_OLDSTYLE_ARRAY_INITIALIZERS=Functions with yield cannot contain Delphi-style array initializers
|
||||
FUNCTION_WITH_YIELD_CANNOT_CONTAIN_OLDSTYLE_RECORD_INITIALIZERS=Functions with yield cannot contain Delphi-style record initializers
|
||||
YIELDS_INSIDE_WITH_ARE_ILLEGAL=with statement cannot contain yields
|
||||
YIELDSEQUENCES_INSIDE_WITH_ARE_ILLEGAL=with statement cannot contain yield sequence
|
||||
LAMBDA_EXPRESSIONS_CANNOT_CONTAIN_YIELD=Lambda-expressions cannot contain yields
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ FUNCTIONS_WITH_YIELDS_CANNOT_CONTAIN_TRY_EXCEPT_FINALLY=Функции с yield
|
|||
FUNCTIONS_WITH_YIELDS_CANNOT_CONTAIN_NESTED_SUBROUTINES=Функции с yield не могут содержать вложенные подпрограммы и сами быть вложенными
|
||||
FUNCTIONS_WITH_YIELDS_CANNOT_CONTAIN_LOCAL_TYPE_DEFINITIONS=Функции с yield не могут содержать локальные определения типов
|
||||
FUNCTIONS_WITH_YIELDS_CANNOT_CONTAIN_INHERITED_CALLS=Функции с yield не могут содержать вызовы inherited методов
|
||||
FUNCTION_WITH_YIELD_CANNOT_CONTAIN_OLDSTYLE_ARRAY_INITIALIZERS=Функции с yield не могут содержать инициализаторы массивов в стиле Delphi
|
||||
FUNCTION_WITH_YIELD_CANNOT_CONTAIN_OLDSTYLE_RECORD_INITIALIZERS=Функции с yield не могут содержать инициализаторы записей в стиле Delphi
|
||||
YIELDS_INSIDE_WITH_ARE_ILLEGAL=Оператор yield запрещен внутри with
|
||||
YIELDSEQUENCES_INSIDE_WITH_ARE_ILLEGAL=Оператор yield sequence запрещен внутри with
|
||||
LAMBDA_EXPRESSIONS_CANNOT_CONTAIN_YIELD=Лямбда-выражения не могут содержать yield
|
||||
|
|
|
|||
Loading…
Reference in a new issue